Software:Work-conserving scheduler

From HandWiki

In computing and communication systems, a work-conserving scheduler is a scheduler that always tries to keep the scheduled resource(s) busy, if there are submitted jobs ready to be scheduled. In contrast, a non-work conserving scheduler is a scheduler that, in some cases, may leave the scheduled resource(s) idle despite the presence of jobs ready to be scheduled. For example, when dealing with networking and packet scheduling, a work-conserving scheduler[1][2] leaves the channel idle only when there are no packets to transmit, whereas a non-work conserving scheduler might leave the channel idle with packets still pending transmission.

Similarly, when referring to CPU scheduling, i.e. threads or processes scheduled over one or more available processors or cores, a work-conserving scheduler[3] ensures that processors/cores are not idle if there are processes/threads ready for execution.

Kleinrock's Conservation Law

Work-conserving schedulers are also notable for obeying Kleinrock's Conservation Law.[4][5]

In the context where we have [math]\displaystyle{ N }[/math] connections with Poisson-distributed arrival rates [math]\displaystyle{ \lambda_n }[/math] packets per unit time each competing for scheduling time, Leonard Kleinrock established the following conservation law:

[math]\displaystyle{ \sum\limits_{n = 1}^N \rho_n q_n = C }[/math] where [math]\displaystyle{ \rho_n = \frac{\lambda_n}{\mu_n} }[/math]

  • [math]\displaystyle{ \lambda_n }[/math]: The mean packet rate of connection [math]\displaystyle{ n }[/math] in packets per unit time.
  • [math]\displaystyle{ \mu_n }[/math]: The number of packets of connection [math]\displaystyle{ n }[/math] that the system overall could transmit per unit time, in units of packets. This can vary between flows if flows have differently sized packets.
  • [math]\displaystyle{ \rho_n }[/math]: The link utilization contributed by a particular flow.
  • [math]\displaystyle{ q_n }[/math]: The expected time a packet from connection [math]\displaystyle{ n }[/math] sits in a buffer before it is served by the scheduler in units of time.
  • [math]\displaystyle{ C }[/math]: A constant - the expected time to clear out all buffered packets from all flows at any given point in time if they are transmitted at maximum service rate with no breaks. To understand why, observe that [math]\displaystyle{ \rho_n q_n = \frac{\lambda_n q_n}{\mu_n} }[/math]. Notice that [math]\displaystyle{ \lambda_n q_n }[/math] is the expected number of buffered packets from flow [math]\displaystyle{ n }[/math], and therefore the expected time to clear them from the buffer is this over the service rate [math]\displaystyle{ \mu_n }[/math]).

(Some sources use [math]\displaystyle{ \mu_n }[/math] to mean the time to service a particular packet with units of unit time per packet, and use [math]\displaystyle{ \rho_n = \lambda_n \mu_n }[/math]. The equation is the same, the only difference being their [math]\displaystyle{ \mu_n }[/math] is the reciprocal of the one presented above.)

Comparison to Non-Work Conserving Schedulers

Non-work conserving schedulers are sometimes useful to enhance predictability and reduce termination jitter for the activities carried out by a computing and communication system. In multi-processor systems they're useful to enhance performance in some scenarios.[6] [7] Sometimes, a non-work conserving scheduler may be useful to enhance stability of a system; For example, a process scheduler may choose to keep processes off of the run queue if there were concern that the sum of the working sets of all of the runnable processes would exceed available memory and lead to non-linear page thrashing overhead. Limiting the run queue in this manner might lead to under-utilization of available processors (and hence be non-work conserving) with the goal of avoiding situations where the system is unusable due to thrashing.

References

  1. [1] Padma Mundur, Improving QOS in IP Networks (course material for Multimedia Networking)
  2. [2] Jon Crowcroft, Scheduling and queue management (course material for Digital Communications II)
  3. [3] G. Buttazzo, G. Lipari, L. Abeni, M. Caccamo, Soft Real-Time Systems: Predictability vs. Efficiency, Springer 2005
  4. Kleinrock, Leonard (1965). "A conservation law for a wide class of queueing disciplines". Naval Research Logistics Quarterly 12 (2): 181–192. doi:10.1002/nav.3800120206. ISSN 0028-1441. 
  5. [4] Jon Crowcroft, Scheduling (course material for Principles of Communications)
  6. [5] A. Fedorova, M. Seltzer and M.D. Smith, "A non-work-conserving operating system scheduler for SMT processors," in Proceedings of the Workshop on the Interaction between Operating Systems and Computer Architecture, in conjunction with ISCA 2006
  7. [6] J. C. Sáez, J. I. Gomez and M. Prieto, "Improving Priority Enforcement via Non-Work-Conserving Scheduling," Parallel Processing, 2008. ICPP '08. 37th International Conference on, Portland, OR, 2008, pp. 99-106.