Blocking Process: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Line 8:
A special case of waiting is sleeping, which is when a process is set inactive for a given period of time (i.e., 20 milliseconds). This is usually handled separately for ordinary waiting, primarily for efficiency reasons; since the clock interrupt is frequent, and keeping track of individual ticks is infeasible, the usual approach to use a system of relative counters to mark when a given process will be awakened.
A commonly used data structure for tracking sleeping processes is the delta queue, an ordered list of sleeping processes in which each process has a counter which is offset relative to last process in the list before it; for example, if process A is sleeping for 3 ticks, process B for 5 ticks,
{A, 3} -> {B, 2} -> {C, 0} -> {D, 3}
|