Linux Process
Linux Process
PROCESS
1
Stopped
Signal
Creation
Ready
Scheduling
End of input/output
Input/output
Suspend
The state variable contains a code for the current state of the process. List of state constants :
TASK_RUNNING TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE TASK_STOPED TASK_ZOMBIE TASK_SWAPING
The counter variable holds the time in tick for which the process still run before mandatory scheduling action is carried out. The priority holds static priority of a process
The flags contains the combination of system status flags PF_ALIGNWARN, PF_PTRACED, PF_TRACESYS, PF_STARTING and PF_EXITING.
struct exec_domain *exec_domain;
10
Every process has its own process ID, and is assigned to a process group and session. Every session has a leader process.
11
All processes are entered in a doubly linked list which the start and end of this list are held in the global variable init_task.
init_task init_task
Process 1 Process 1
Process 2 Process 2
Process N Process N
12
All processes have the family relationships which has created it using the system call fork().
13
p_pptr
These are inherited by the child process from the parent process. The fsuid and fsgid are used for actual access control to the file system.
16
17
The sig is a signal handler. The signal variable contains a bit mask for signals received for the process. The blocked contains a bit mask for all the signals the process intends to handle later.
18
The start_time contains the time at which the current process was generated. The it_real_value, it_prof_value, it_virt_value, it_real_incr, it_prof_incr and it_virt_incr are used in the interval timer (interrupt).
19
Process Scheduling
Linux uses two process-scheduling algorithms: A time-sharing algorithm for fair preemptive scheduling between multiple processes A real-time algorithm for tasks where absolute priorities are more important than fairness A processs scheduling class defines which algorithm to apply. For time-sharing processes, Linux uses a prioritized, credit based algorithm. The crediting rule
credits := credits + priority 2
factors in both the processs history and its priority. This crediting system automatically prioritizes interactive or I/O-bound processes.
20
21
: task are normal user tasks (default) SCHE_FIFO : task that running with this policy will never be preempted. It is a real-time policy. SCHE_RR : this is an another real-time policy, but the task will leave the CPU if there is another realtime task in the run queue.
SCHE_OTHER
22
23
Creation
Ready
End of input/output
Input/output
Suspend
Creation
Ready
Scheduling
End of input/output
Input/output
Suspend
27
28