1 / 13

Round Robin (RR)

Round Robin (RR). Each process gets a small unit of CPU time ( time quantum ), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue.

damara
Télécharger la présentation

Round Robin (RR)

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. Round Robin (RR) • Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. • If there are n processes in the ready queue and the time quantum is 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 is too high

  2. P1 P2 P3 P1 P1 P1 P1 P1 0 10 14 18 22 26 30 4 7 Example of RR with Time Quantum = 4 ProcessBurst Time P1 24 P2 3 P3 3 • The Gantt chart is: • Typically, higher average turnaround than SJF, but better response

  3. Properties of RR Advantages: simple, low overhead, works for interactive systems Disadvantages: if quantum too small, too much time wasted in context switching; if too large, approaches FCFS.Typical value: 10 - 100 msecRule of thumb: choose quantum so that large majority (80-90%) of jobs finish CPU burst in one quantum

  4. Priority Scheduling • A priority number (integer) is associated with each process • The CPU is allocated to the process with the highest priority (smallest integer  highest priority) • Preemptive • nonpreemptive • 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

  5. Multilevel Queue • Ready queue is partitioned into separate queues:foreground (interactive)background (batch) • Each queue has its own scheduling algorithm • foreground – RR • background – FCFS • Scheduling must be done between the queues • Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. • Time slice – each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR • 20% to background in FCFS

  6. Multilevel Feedback Queue • A process can move between the various queues; aging can be implemented this way • Multilevel-feedback-queue scheduler defined by the following parameters: • number of queues • scheduling algorithms for each queue • method used to determine when to upgrade a process • method used to determine when to demote a process • method used to determine which queue a process will enter when that process needs service

  7. Example of Multilevel Feedback Queue • Three queues: • Q0 – RR with time quantum 8 milliseconds • Q1 – RR time quantum 16 milliseconds • Q2 – FCFS • Scheduling • A new job enters queue Q0which is servedFCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q1. • At Q1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q2.

  8. Time quantum increases as priority level decreases

  9. Process operation 1. creation 2. Termination Creation:- There are four principal events led to processes creation. 1. System initialization. 2 .Execution of a process Creation System calls by a running process. 3. A user request to create a new process. 4. Initialization of a batch job. Role of operating system during process creation Assign unique process identifier to the new process Allocate space for the process Initialize the process control block Set the appropriate linkage Create or expand other data structure

  10. Termination:- The new process terminates the existing process, usually due to following reasons:Normal Exist    Most processes terminates because they have done their job. This call is exist in UNIX. Error Exist    When process discovers a fatal error. For example, a user tries to compile a program that does not exist. Fatal Error    An error caused by process due to a bug in program for example, executing an illegal instruction, referring non-existing memory or dividing by zero. Killed by another Process    A process executes a system call telling the Operating Systems to terminate some other process. In UNIX, this call is kill. In some systems when a process kills all processes it created are killed as well (UNIX does not work this way). A process terminates when it finishes executing its last statement. 1.Its resources are returned to the system, 2.it is purged from any system lists or tables, and its process control block (PCB) is erased i.e., the PCB's memory space is returned to a free memory pool.

  11. Case Studies (Suggested): • MS-DOS • Windows NT • Windows 2008 Server • Windows 7 • Unix • Linux • OS/2 • MAC OS • Symbian • Chrome • Android

More Related