Processes and threads are fundamental abstractions in the operating system. To support processes and threads, the OS uses two key data structures: task_struct
and thread_info
; as well as a host of auxiliary functions for managing processes and threads in the system.
The
arch/arm/include/asm/thread_info.h
file declares the
thread_info
structure.
The
include/linux/sched.h
file declares the
task_struct
structure, along with many process management functions.
The
arch/arm/include/asm/switch_to.h
file defines an ARM architecture
specific macro for the
switch_to
process switch routine, and the
arch/arm/kernel/entry-armv.S
file implements the
__switch_to
assembly level process switch routine that is used by that macro.
The proc
pseudo-filesystem provides information about system process resource usage as a whole,
as well as information and statistics for individual processes.
The
include/linux/proc_fs.h
header file declares the constants and structures used by the proc
filesystem.
The
fs/proc
directory includes the source code files for its kernel-backed functionality.
Of particular interest are the following files:
The
fs/proc/fd.h
and
fs/proc/fd.c
files implement the /proc/PID/fd
directoy that contains a symlink for each of the process's open file descriptors.
The
fs/proc/stat.c
file implements the /proc/PID/stat
file that contains various runtime and resource usage statistics about the process.
The
fs/proc/cmdline.c
file implements the /proc/PID/cmdline
file that shows the command used to launch the process.