Process control: create new processes, cancel existing processes, realize process state transition, etc.
Primitive: Program segment used for process control. Interrupts are not allowed during execution , and "interrupts off" and "interrupts on" instructions (privileged instructions) are used to achieve atomicity. After turning off the interrupt, the interrupt signal will no longer be checked routinely (continuously executed) until the check is resumed after the interrupt is turned on.
Creation of process
Created state->Ready state
Creation primitives: ① apply for a blank PCB ② allocate resources ③ initialize the PCB ④ insert a new process into the ready queue
process termination
Ready/Blocked/Running->Terminated->None
Termination: normal end (exit), abnormal end, external intervention
Termination primitives: ①Read status ②Stop process (self and child processes) ③Return resources (parent process or operating system) ④Return PCB
Process blocking and waking up
Running state→Blocking state
Blocking primitives: ① Find PCB ② Protect the site (running state → blocking state) ③ PCB is inserted into the waiting queue, and the processor resources are scheduled to other ready processes
Blocked state→Ready state
Wake-up primitive: ① Find PCB ② Move out of the waiting queue → ready state ③ PCB is inserted into the queue and wait for scheduling
Blocking primitives and wake-up primitives must be used in pairs, otherwise the blocking process will be permanently blocked because it cannot be awakened.