What happened to priorities? ò Priorities let me be deliberately unfair ò This is a useful feature Ò Strategies: ò Could initialize to current time (start at right) ò Could get half of parent’s deficit Ò Global vclock ticks once every 4 real ticks ò Each task scheduled for one real tick advances local clock by one tickĮdge case 1 ò What about a new task? ò If task ticks start at zero, doesn’t it get to unfairly run for a long time? Ò No more runqueues ò Just a single tree-structured timeline More details ò Task’s ticks make key in RB-tree ò Fewest tick count get serviced first Ò Each task counts how many clock ticks it has had ò Example: 4 tasks Ò log(n) time for: ò Picking next task (i.e., search for left-most task) ò Putting the task back when it is done (i.e., insertion) ò Remember: n is total number of tasks on systemĭetails ò Global virtual clock: ticks at a fraction of real time ò Fraction is number of total tasks Ò Always pick the “neediest” task to run ò Until it is no longer neediest ò Then re-insert old task in the timelineīut lists are inefficient ò Duh! That’s why we really use a tree ò Red-black tree: 9/10 Linux developers recommend it Ò Elegance: Structure (and complexity) of solution matches problemĬFS idea ò Back to a simple list of tasks (conceptually) ò Ordered by how much time they’ve had ò Least time to most time Ò Software engineering observation: ò Kernel developers better understood scheduling issues and workload characteristics, could make more informed design choice batch jobs? ò CPU topologies? ò Per-user fairness? ò Alice has one task and Bob has 49 why should Bob get 98% of CPU time?Įditorial ò Real issue: O(1) scheduler bookkeeping is complicated ò Heuristics for various issues makes it more complicated ò Heuristics can end up working at cross-purposes Ò Other advanced scheduling issues ò Real-time scheduling ò Kernel preemption ò Priority laundering ò Security attack trick developed at Stony Brookįair Scheduling ò Simple idea: 50 tasks, each should get 2% of CPU time ò Do we really want this? ò What about priorities? ò Interactive vs. Ò Today: Completely Fair Scheduler (CFS) – new hotness ò O(1) scheduler – older Linux scheduler Using the Gantt chart, Average waiting time is calculated as given below −Īverage waiting time = 17/3 = 5.Last time… ò Scheduling overview, key trade-offs, etc. As shown in the table, Process P2 requires only 3 milliseconds to complete its execution so CPU will be allocated for time quantum of 3 milliseconds only instead of 4 milliseconds. Since the time quantum is of 4 milliseconds, process P1 gets the first 4 milliseconds but it requires another 20 millisecond to complete its execution but CPU will preempt it after the first time quantum and CPU will be allocated to the next process P2. We are given with 3 processes P1, P2 and P3 with their corresponding burst time as 24, 3 and 3 Process Waiting Time = turnaround time – burst time Example Waiting Time is the difference between turnaround time and burst time Turnaround Time = completion of a process – submission of a process Turnaround Time is the time interval between the submission of a process and its completion. The only disadvantage of it is overhead of context switching.Ĭompletion Time is the time required by the process to complete its execution It follows preemptive approach because fixed time are allocated to processes. CPU treat ready queue as a circular queue for executing the processes with given time slice. Time quantum can range from 10 to 100 milliseconds. A small unit of time is known as Time Quantum or Time Slice. It is more like a FCFS scheduling algorithm with one change that in Round Robin processes are bounded with a quantum time size. Round robin is a CPU scheduling algorithm that is designed especially for time sharing systems. We are given with the n processes with their corresponding burst time and time quantum and the task is to find the average waiting time and average turnaround time and display the result.
0 Comments
Leave a Reply. |