First, the Process Control theory Foundation
Process: is a running activity of a program with a certain independent function. The program is static and the program runs as a process.
1, the characteristics of the process:
Dynamic: Distinguishing features from the program
Concurrency: Multiple processes can execute concurrently
Independence: Independent
Async: Asynchronous operations can be performed between processes and processes
2, process three states:
Process ID (PID): A unique number that flags the process.
Parent process ID (PPID)
User ID (UID) of the startup process
3. Process Mutex
Process mutex is when a shared resource is used by a number of processes, at most one process is allowed at any time, and the other process that uses the resource must wait until the resource is freed by the resource.
Critical resources: At the same time, a resource that only allows one process to access is called a critical resource.
Critical section: The program code that accesses a critical resource in a process becomes a critical section.
In order to achieve mutually exclusive access to critical resources, it is necessary to ensure that each program enters its critical section successively .
4. Process synchronization
The process of executing a set of concurrent processes in a certain order (in a fixed order) is known as inter-process synchronization.
A set of concurrent processes with a synchronization relationship is called a cooperative process.
Signals that are sent to each other in the process of cooperation become messages or events.
5. Process scheduling
According to a certain algorithm, from a set of processes to run to choose one to occupy the CPU operation.
Dispatch mode:
1) Preemptive: A B process, A is executing, B is ready, but the priority of B is high, then a pauses, B runs
2) Non-preemptive: a B process, A is executing, B is ready, but B has a high priority, but waits until a ends and B runs.
Scheduling algorithm
1) first come first service
2) Short process priority (short run time preferred)
3) High priority priority
4) Time slice rotation method: Divide the time slice, each process in the time slice, in turn occupies the CPU.
6. Deadlock
A stalemate in the process of competing resources, without external forces, will never be able to move forward.