tn actual length of nth burst τ n 1 predicted value for the next CPU burst α 0

# Tn actual length of nth burst τ n 1 predicted value

• edwardtoo165
• 37

This preview shows page 22 - 32 out of 37 pages.

° t n = actual length of nth burst ° τ n +1 =predicted value for the next CPU burst ° α = 0, 0 ≤ α ≤ 1 ° Define ± τ n +1 = α t n + (1- α ) τ n
Exponential Averaging(cont.) ° α = 0 ° τ n +1 = τ n ; Recent history does not count ° α = 1 τ ° n +1 = t n ; Only the actual last CPU burst counts. ° Similarly, expanding the formula: ° τ n +1 = α t n + (1- α ) α t n -1 + …+ (1- α )^j α t n - j + … (1- α )^( n +1) τ 0 ± Each successive term has less weight than its predecessor. j
Priority Scheduling ° A priority value (integer) is associated with each process. Can be based on ± Cost to user ± Importance to user Aging ± ± %CPU time used in last X hours. ° CPU is allocated to process with the highest priority. ° Preemptive ° Nonpreemptive
Priority Scheduling (cont.) ° SJN is a priority scheme where the 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.
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. ° n processes, time quantum = q Each process gets 1/ n CPU time in chunks of at most q ± time units at a time. ± No process waits more than ( n -1) q time units. ± Performance ² Time slice q too large - FIFO behavior ² Time slice q too small - Overhead of context switch is too expensive. ² Heuristic - 70-80% of jobs block within timeslice
Round Robin Example ° Time Quantum = 20 Process Burst Time P1 53 P2 17 P3 68 P4 24 0 P1 P4 P3 Gantt Chart for Schedule P1 P2 20 P3 P3 P3 P4 P1 37 57 77 97 117 121 134 154 162 Typically, higher average turnaround time than SRTF, but better response
Multilevel Queue ° Ready Queue partitioned into separate queues ± Example: system processes, foreground (interactive), background (batch), student processes…. ° Each queue has its own scheduling algorithm ± Example: foreground (RR), background(FCFS) ° Processes assigned to one queue permanently. ° Scheduling must be done between the queues ± Fixed priority - serve all from foreground, then from background. Possibility of starvation. ± Time slice - Each queue gets some CPU time that it schedules - e.g. 80% foreground(RR), 20% background (FCFS)
Multilevel Queues
Multilevel Feedback Queue ° Multilevel Queue with priorities ° A process can move between the queues. ± Aging can be implemented this way. ° Parameters for a multilevel feedback queue scheduler: ± number of queues. ± scheduling algorithm 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.
Multilevel Feedback Queues ° Example: Three Queues - ± Q0 - time quantum 8 milliseconds (RR) ± Q1 - time quantum 16 milliseconds (RR) ± Q2 - FCFS Scheduling ° ± New job enters Q0 - When it gains CPU, it receives 8 milliseconds. If job does not finish, move it to Q1.

#### You've reached the end of your free preview.

Want to read all 37 pages?

• One '20

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern