Processes (user and system) get process numbers which are distinct from pid's.
The process number is almost the index in the process table, which in general has no relation to the process id.
The process numbers of the system tasks and the first few system processes:
- IDLE -4
- CLOCK -3
- SYSTEM -2
- KERNEL -1
- pm 0
- fs 1
- rs 2
NR_TASKS is 4 and each task has a negative process number; i.e., -4 to -1.
The IDLE process (has process nr -4) is in the proc table at index 0. In general a process is at index (process nr) + NR_TASKS.
Here are the process numbers and process id's of the user level system processes, pm, fs, rs, and one example user process (emacs):
Process Name | Process NR | Process Endpoint | Index in proc table |
---|---|---|---|
IDLE | -4 | (-4) | 0 |
CLOCK | -3 | (-3) | 1 |
SYSTEM | -2 | (-2) | 2 |
KERNEL | -1 | (-1) | 3 |
pm | 0 | 0 | 4 |
vfs | 1 | 1 | 5 |
rs | 2 | 2 | 6 |
emacs | 31 | 73147 | 35 |
Note:
- proc_nr = endpoint % _ENDPOINT_GENERATION_SIZE
- _ENDPOINT_GENERATION_SIZE = 0x8ace + 1024 = 0x8ece = 36558
For the example emacs entry:
proc_nr = 73147 % 36558 = 31 index in pm's process table = 31 index in kernel process table = 31 + 4 = 35