Every processor in a CPU has queue called runqueue associated with it. Each runqueue has 2 priority arrays, the active and the expired. Active array stores the processes that still have some time slice. Once this time finished, they go to the expired array. Each array has 140 entries (queues), one for each privilege level (So 140 + 140 ).
Run queue
has 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. Active processes are placed in an array called a run queue
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 (prior to kernel 2.6.23), each CPU in the system is given a run queue, which maintains both an active and expired array of processes.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.
How to Check
a) sar -q command is used to check the run queue.
runq-sz : Run queue
length (number of tasks waiting for run time)
plist-sz : Number of
tasks in the task list.
b) vmstat can also be used to
determine the number of processes that are queued to run or waiting to run. These
appear in the 'r' column.
What is Ready Queue and Run Queue
In operating system , Process that are ready to execute when given the opportunity to execute are sent to ready queue.
Whenever there is a space in run queue, for running
the process, Process from ready state in ready queue is sent to run queue.
No comments:
Post a Comment