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.
Famous quotes containing the words run and/or queue:
“Do you know I believe that [William Jennings] Bryan will force his nomination on the Democrats again. I believe he will either do this by advocating Prohibition, or else he will run on a Prohibition platform independent of the Democrats. But you will see that the year before the election he will organize a mammoth lecture tour and will make Prohibition the leading note of every address.”
—William Howard Taft (18571930)
“English people apparently queue up as a sort of hobby. A family man might pass a mild autumn evening by taking the wife and kids to stand in the cinema queue for a while and then leading them over for a few minutes in the sweetshop queue and then, as a special treat for the kids, saying Perhaps weve time to have a look at the Number Thirty-One bus queue before we turn in.”
—Calvin Trillin (b. 1940)