Kernelschedc

struct rq {

unsigned long nr_running;

#define cPU_LOAD_IDX_MAX 5

unsigned long cpu_load[cPU_LOAD_IDX_MAX];

struct load_weight load;

struct cfs_rq cfs; struct rt_rq rt;

struct task_struct *curr, *idle; u64 clock;

□ nr_running specifies the number of runnable processes on the queue — regardless of their priority or scheduling class.

23However, threads originating from the same process can execute on different processors as task management makes no important distinction between processes and threads.

24For readers familiar with earlier versions of the kernel, it might be interesting to know the scheduler class run queues replace the lists of active and expired tasks that were utilized by the previous O(1) scheduler.

□ load provides a measure for the current load on the run queue. The queue load is essentially proportional to the number of currently active processes on the queue, where each process is additionally weighted by its priority. The speed of the virtual per-run queue clock is based on this information. Since computing the load and other related quantities is an important component of the scheduling algorithm, I devote Section 2.5.3 below to a detailed discussion of the mechanisms involved.

□ cpu_load allows for tracking the load behavior back into the past.

□ cfs and rt are the embedded sub-run queues for the completely fair and real-time scheduler, respectively.

□ curr points to the task structure of the process currently running.

□ idle points to the task structure of the idle process called when no other runnable process is available — the idle thread.

□ clock and prev_raw_clock are used to implement the per-run queue clock. The value of clock is updated each time the periodic scheduler is called. Additionally, the kernel provides the standard function update_rq_clock that is called from many places in the scheduler that manipulate the run queue, for instance, when a new task is woken up in wakeup_new_task.

All run queues of the system are held in the runqueues array, which contains an element for each CPU in the system. On single-processor systems, there is, of course, just one element because only one run queue is required.

Continue reading here: Info

Was this article helpful?

0 0