Jump to content

Run queue: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
JL-Bot (talk | contribs)
m removing orphan template as not a valid orphan
Asb-89 (talk | contribs)
Added implementation details, clarifications
Line 1: Line 1:
{{Unreferenced stub|auto=yes|date=December 2009}}
{{Unreferenced stub|auto=yes|date=December 2009}}
In modern computers many [[Process (computing)|processes]] run at once. To ensure each program has a fair share of resources, each one is run for a period. When a program is taken out to let another run it is placed on the end of the '''run queue''', and the program at the head of the run queue is then allowed to execute.
In modern computers many [[Process (computing)|processes]] run at once. Active processes are placed in an array called a '''run queue''', or '''runqueue'''. The run queue may contain priority values for each process, which will be used by the [[Scheduling (computing)|scheduler]] to determine which process to run next. To ensure each program has a fair share of resources, each one is run for some time period (quantum) before it is paused and placed back into the run queue. When a program is stopped to let another run, the program with the highest priority in the run queue is then allowed to execute.


Processes are also removed from the run queue when they ask to ''sleep'', are waiting on a resource to become available, or have been terminated.
Processes are also removed from the run queue when they ask to ''sleep'', are waiting on a resource to become available, or have been terminated.

In the [[Linux]] operating system, each CPU in the system is given a run queue, which maintains both an active and expired array of processes. Each array contains 140 (one for each priority level) pointers to [[Doubly-linked list|doubly-linked lists]], which in turn reference all processes with the given priority. The scheduler selects the next process from the active array with highest priority. When a process' quantum expires, it is placed into the expired array with some priority. When the active array contains no more processes, the scheduler swaps the active and expired arrays.


In [[UNIX]] or [[Linux]] the [[Sar in UNIX|sar]] command is used to check the run queue.
In [[UNIX]] or [[Linux]] the [[Sar in UNIX|sar]] command is used to check the run queue.


==References==
{{DEFAULTSORT:Run Queue}}
[[Category:Operating system technology]]


* Tanenbaum AS (2008) ''Modern Operating Systems'', 3rd ed., p. 753-4. Pearson Education, Inc. ISBN 0-13-600663-9</ref>


{{DEFAULTSORT:Run Queue}}
{{operating-system-stub}}
[[Category:Operating system technology]]

Revision as of 19:20, 12 February 2011

In modern computers many processes run at once. Active processes are placed in an array called a run queue, or runqueue. The run queue may contain priority values for each process, which will be used by the scheduler to determine which process to run next. To ensure each program has a fair share of resources, each one is run for some time period (quantum) before it is paused and placed back into the run queue. When a program is stopped to let another run, the program with the highest priority in the run queue is then allowed to execute.

Processes are also removed from the run queue when they ask to sleep, are waiting on a resource to become available, or have been terminated.

In the Linux operating system, each CPU in the system is given a run queue, which maintains both an active and expired array of processes. Each array contains 140 (one for each priority level) pointers to doubly-linked lists, which in turn reference all processes with the given priority. The scheduler selects the next process from the active array with highest priority. When a process' quantum expires, it is placed into the expired array with some priority. When the active array contains no more processes, the scheduler swaps the active and expired arrays.

In UNIX or Linux the sar command is used to check the run queue.

References

  • Tanenbaum AS (2008) Modern Operating Systems, 3rd ed., p. 753-4. Pearson Education, Inc. ISBN 0-13-600663-9</ref>