Process Concepts
Function of kernel: process management, file system, network function, memory management, driver, security function, etc.
Process: A copy of a running program that is a collection of instructions that is loaded into memory
Process id,pid number is used to mark individual processes
UID, GID, and selinux contexts determine access and access to the file system,
Typically inherit from the user who executes the process
Existence life cycle
Task Struct:linux data structure format for kernel store process information
Task List: A list of task structs consisting of multiple tasks
Process creation:
Init: First Process
Parent-child Relationship
Process: all created by its parent process, CoW
Fork (), Clone ()
Basic state and transformation of a process
The basic state of the process
Create State : When the process is created, it needs to request a blank PCB (Process Control block), fill in the information of the control and management process, and complete the resource allocation. If the creation of the work cannot be completed, such as the resources can not be satisfied, it can not be scheduled to run, the status of the process is called the creation State
Ready state : The process is ready, assigned to the required resources, and can be run as soon as it is assigned to the CPU
execution state : After the process is ready, the process enters the execution state
Blocking Status : The process being executed is temporarily unable to run due to certain events (I/O requests, failed request buffers), and processes are blocked. Enter ready state to wait for system calls when the request is satisfied
Termination Status : The process ends, or an error occurs, or is terminated by the system and enters the terminating state. No more execution
Transitions between states six cases
run-ready : 1, mainly the process takes up CPU time is too long, and the system allocated to the process CPU time is limited, 2, in the system using preemptive priority scheduling algorithm, when a higher priority of the process to run, the process is forced to give up the CPU, The process transitions from the execution state to the ready state.
ready -to-run: The running process runs out of time slices and the scheduler goes to the ready queue to select the appropriate process to allocate the CPU
run -to-block: The executing process cannot execute due to a wait event, the process is changed from execution state to blocked state, such as an I/O request occurred
blocked-ready : The event that the process waits for has already occurred and enters the ready queue
The following two states are unlikely to occur:
Block -to-run: even if the blocking process is allocated CPU and cannot be executed, the operating system does not pick from the blocking queue when scheduling, but chooses from the ready queue
ready -to-block: The ready state is not executed at all, not into the blocking state
Process priority
Process priority:
0-139 (centos4,5)
Each has 140 run queues and an expiration queue
0-98,99 (CENTOS6)
Real-time Priority: 99-0 Value Maximum priority
Nice value: 20 to 19, corresponding to system priority 100-139 or 99
? Big O: The relationship between time complexity, timing, and scale
O (1), O (Logn), O (n) linear, O (n^2) parabolic, O (2^N) system priority: the smaller the number, the higher the priority
Process-related concepts
LRU Algorithm
Linux Nine Yin Canon no Shadow Sword Fragment 7 (process and Scheduled Tasks)