Dispatch system code structure Most of the implementation code of scheduling system, including the definition of runqueue structure, all in the [KERNEL/SCHED.C] file, the purpose of this is to all the scheduling system code together, easy to update and replace. Unless otherwise noted, the code and function implementations cited herein are located in [KERNEL/SCHED.C].
3. The improved Task_struct
the 2.6 version of the kernel still uses task_struct to characterize the process, although the thread is optimized, but the thread's kernel representation is still the same as the process. With the improvement of dispatcher, the content of task_struct has been improved, and the new features of interactive process priority support and kernel preemption support are embodied in task_struct. In task_struct, some attributes are newly added, and the meaning of the values of some attributes changes, while some attributes simply change the name.
1) state
The status of the process is still represented by state, and the difference is that the state constants in 2.6 are redefined to facilitate bitwise manipulation:
/ * excerpt from [include/linux/sched.h] * *
#define TASK_RUNNING 0
#define TASK_INTERRUPTIBLE 1
#define Task_uninterruptible 2
#define TASK_STOPPED 4
#define Task_zombie 8
#define Task_dead
The newly added task_dead refers to processes that have exited and do not require a parent process to recycle.
2) Timestamp
the time that the process occurred scheduling events (in nanosecond, see below). Includes the following categories:
the time of being awakened (set in Activate_task ());
the time that was switched off (schedule ());
time to be switched (schedule ());
load-balancing-related assignments (see "Scheduler-related load Balancing").
from the difference between this value and the current time, you can obtain the information related to the priority calculation, such as the "Time to run in the ready queue" and "Run Time" (see "Optimized priority calculation Method").