SlideServe
Menu
Préférences
© SlideServe · v2026

CPU Scheduling

august-allison avatar
12 diapositives · 278 Views · Oct 31, 2014

CPU Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms Scheduling in BSD UNIX. Scheduling Criteria. CPU utilization – Percent time CPU busy Throughput – # of processes that complete their execution per time unit

CPU Scheduling - slide 1
01 / 12CPU Scheduling
1 / 17

Télécharger la présentation

CPU Scheduling
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. CPU Scheduling • Basic Concepts • Scheduling Criteria • Scheduling Algorithms • Scheduling in BSD UNIX

  2. Scheduling Criteria • CPU utilization – Percent time CPU busy • Throughput – # of processes that complete their execution per time unit • Turnaround time–time to execute a process: from start to completion. • Waiting time –time in Ready queue • Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)

  3. Optimization Criteria • Max CPU utilization • Max throughput • Min turnaround time • Min waiting time • Min response time

  4. P1 P2 P3 0 24 27 30 First-Come, First-Served (FCFS) • Example: ProcessBurst Time P1 24 P2 3 P33 • Assume processes arrive as: P1 , P2 , P3 The Gantt Chart for the schedule is: • Waiting time forP1 = 0; P2= 24; P3= 27 • Average waiting time: (0 + 24 + 27)/3 = 17

  5. P2 P3 P1 0 3 6 30 FCFS Scheduling (Cont.) Suppose processes arrive as: P2 , P3 , P1 . • The Gantt chart for the schedule is: • Waiting time for P1 = 6;P2 = 0; P3 = 3 • Average waiting time: (6 + 0 + 3)/3 = 3 • Much better than previous case. • Convoy effector head-of-line blocking • short process behind long process

  6. Shortest-Job-First (SJR) Scheduling • Process declares its CPU burst length • Two schemes: • non-preemptive – once CPU assigned, process not preempted until its CPU burst completes. • Preemptive – if a new process with CPU burst less than remaining time of current, preempt. Shortest-Remaining-Time-First (SRTF). • SJF is optimal – gives minimum average waiting time for a given set of processes.

  7. P1 P3 P2 P4 0 3 7 8 12 16 Example of Non-Preemptive SJF Process Arrival Time Burst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 • SJF (non-preemptive) • Average waiting time • = (0 + 6 + 3 + 7)/4 = 4

  8. P1 P2 P3 P2 P4 P1 11 16 0 2 4 5 7 Example of Preemptive SJF ProcessArrival TimeBurst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 • SJF (preemptive) • Average waiting time • = (9 + 1 + 0 +2)/4 = 3

  9. Priority Scheduling • Priority associated with each process • CPU allocated to process with highest priority • Preemptive or non-preemptive • Example - SJF: priority scheduling where priority is predicted next CPU burst time. • Problem: Starvation • low priority processes may never execute. • Solution: Aging • as time progresses increase the priority of the process.

  10. Round Robin (RR) • Each process assigned a time quantum, usually 10-100 milliseconds. After this process moved to end of the Ready Q • n processes in ready queue, time quantum = q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. • Performance • q large  FIFO • q small  q must be large with respect to context switch, otherwise overhead too high.

  11. P1 P2 P3 P4 P1 P3 P4 P1 P3 P3 0 20 37 57 77 97 117 121 134 154 162 Example: RR, Quantum = 20 ProcessBurst Time P1 53 P2 17 P3 68 P4 24 • The Gantt chart is: • Typically, higher average turnaround than SJF, but better response.

  12. Small Quantum Increased Context Switches