1.

Which algorithm called shortest remaining tine 1st sheduling?

Answer»

t Remaining Time SchedulingShortest remaining time (SRT) schedulingShortest remaining time scheduling is the preemptive counter part of SJF and is useful in time sharing system. In SRT, process with the smallest estimated run time to completion is run next, in SJF once a job begin executing, it runs to completion. In SRT a running process may be preempted by a user process with a shorter estimated run time.Consider an example, where three processes arrived in the order P1, P2, P3 at the time mentioned below, and then the average waiting time USING SJF scheduling algorithm will be calculated as:process CPU Burst Time Time of Arrivalp1 10 0p2 5 1p3 2 2shortest remaining time schedulingshortest remaining time schedulingIn this, the CPU will be taken away from the currently executing process whenever a process will less CPU burst time.As shown in figure, the time when P2 arrives P1 needs 9 millisecond more to finish. As B’s cpu burst in 5 millisecond < 9 millisecond, therefore, P1’s execution will be preempted and P2 will be EXECUTED but against as P3 arrives P2’s execution needs 3 more millisecond where as P3 needs only 2 millisecond to EXECUTE, thus P3 TAKES over P2 and so on.Waiting time for P1 = 0+ (8-1) = 7 millisecondWaiting time for P2 = 1+ (4-2) = 3 millisecondWaiting time for P3 = 2 millisecondAverage waiting time = (7+3+2) / 3 = 4 millisecond



Discussion

No Comment Found