1 / 11

Lab6

Lab6. IT325. CPU Scheduling. F irst C ome F irst S erve (FCFS):. Jobs are scheduled in order of arrival Non-preemptive Problem: Average waiting time depends on arrival order Troublesome for time-sharing systems Convoy effect short process behind long process.

major
Download Presentation

Lab6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab6 IT325 CPU Scheduling

  2. First Come First Serve (FCFS): • Jobs are scheduled in order of arrival • Non-preemptive • Problem: • Average waiting time depends on arrival order • Troublesome for time-sharing systems • Convoy effect short process behind long process

  3. Shortest Job First (SJF) • Use next CPU burst lengths to schedule the process with the shortest time • If the next CPU bursts of two processes are the same,  scheduling is used. • Two schemes: • nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst • preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is known as the FCFS Shortest-Remaining-Time-First (SRTF)

  4. Shortest Job First (SJF) • Optimal, gives minimum average waiting time for a given set of processes • There are no accurate estimations to know the length of the next CPU burst

  5. Priority Scheduling • The CPU is allocated to the process with the highest priority (smallest integer  highest priority in Unix but lowest in Java). • Equal-priority processes are scheduled in FCFS order. • Preemptive • Non-preemptive • SJF is a priority scheduling where priority is the predicted next CPU burst time. • Problem  Starvation: low priority processes may never execute. • Solution  Aging : as time progresses increase the priority of the process.

  6. Round Robin (RR) • Similar to FCFS scheduling, but preemption is added to switch between processes • Preemptive FCFS = • Each process gets a small unit of CPU time (time quantum). After this time has elapsed, the process is preempted and added to the end of the ready queue. RR

  7. Round Robin (RR) • Typically, higher average turnaround than SJF, but better response. • Performance • q large  FCFS • q small  q must be large with respect to context switch, otherwise overhead is too high. • If : • The process may have a CPU burst of < time quantum the process itself will release the CPU voluntarily. • The CPU burst of the currently running process > time quantum  the timer will go off and will cause an interrupt to the OS.  a context switch will be executed, and the process will be put at the tail of the ready queue.

  8. Round Robin (RR) • Typically, higher average turnaround than SJF, but better response • Response: • amount of time it takes from when a request was submitted until the first response is produced (for time-sharing environment) • Turnaround: • amount of time to execute a particular process

  9. “The perfect CPU scheduler” • Minimize latency: response or job completion time • Maximize throughput: Maximize jobs / time. • Maximize utilization: keep I/O devices busy. • Fairness: everyone makes progress, no one starves

  10. Some Equations: • Turnaround Time (TAT)= End Time – Arrival Time. • End Time Knownas Termination Time. • Waiting Time = End Time – Arrival Time – CPU Burst Time Waiting Time = TAT – CPU Burst Time • CPU Burst Time Known as Service Time.

  11. Some Equations Cont. : • In the non-preemptive algorithms: • Waiting Time = Start Time – Arrival Time. • End Time = Start Time + CPU Burst Time.

More Related