The kernel Directory
Most of the critical kernel functions are implemented in this
directory. The most important of the source files here is sched.c,
which deserves special treatment.
sched.c
As the source itself states, this is ``the main kernel file.'' It consists of the scheduler and related operations, such as putting processes to sleep and waking them up, as well as management of the kernel timers (see Section 6.5 in Chapter 6), the interval timers (which are related to accounting and profiling), and the predefined task queues (see Section 6.4.2 in Chapter 6).
If you are interested in the real-time policies of the Linux scheduler, you’ll find the low-level information in the schedule function and its relatives. One such relative is goodness, which assigns preference values to processes, to help the scheduler choose the next process to run.
The functions (and system calls) related to scheduler control are also defined in this file. This includes the code for setting and retrieving scheduling policies and priorities. The nice system call is also found in this source file for every architecture except the Alpha.
In addition, the short system calls to get and set user and group
ids are defined in sched.c (except on the Alpha), as well
as the alarm call.[42]
Additional goodies found in sched.c include the
show_tasks and show_state functions, which implement two
of the ``magic'' keys described in
"Section 4.4.2,” in Chapter 4.
Process Control
Most of the rest of the directory ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access