OS--Process Control new Template small book Carpenter reference
"Computer Operating System" (fourth edition) Tang Xiaodan and other authoring
Concept Introduction Process Control
Process Control is the most basic function, responsible for creating processes, ending processes and other functions, generally by the OS kernel primitives to implement
Primitive language
The so-called primitive language, is composed of a number of instructions, used to complete a certain function of a process, is an inseparable, the most basic operation
Note
- The primitives are then used basically for all the operations
Operating system kernel
The operating system will have some commonly used or high-frequency modules (such as clock management, process scheduling, etc.) resident memory, which is known as the OS kernel
Two major functions
-
support function
- interrupt handling
- Clock management
- primitive Actions
-
Resource management function
- process Management
- memory management
- Device Management
Hierarchy of process creation process
A process can create another process that forms the relationship of the parent and child processes
Note
- Process cannot deny inheritance of child processes
- When the parent process is revoked, the child process also has to be over
- Depending on the parent-child process, you can form a tree of processes
- window, when a process creates another process, it obtains a handle that forms a control-and-control relationship
Events that cause the creation process
- User Login
- Job scheduling
- Provision of services
- App Request
Creation of processes
Calling a process to create primitive language creat
- Request a blank PCB (Process Control block) to obtain a unique numeric identifier
- Resources required for the allocation process
- Initialize PCB
- When allowed, insert the ready queue
An event that causes a process to terminate when a process terminates
-
normal end
-
- out of bounds error: Store beyond process access
- Protection Error: The process is attempting to access a resource or file that cannot be accessed
- illegal directive: Access a nonexistent instruction
- run timeout
- Wait Timeout
- arithmetic operation error
- I/O fault
-
external intervention
Note: The most typical kind of Ctrl + C bar
The process of terminating a process
Call into Terminate primitive
- Retrieves the PCB of the process from the PCB collection based on the identifier of the process, reading the process status
- If the process is still executing, immediately terminates execution of the process, and the collocated dispatch flag is true, indicating that the process should be dispatched after it has been terminated
- If the process also has a descendant process, the process of its descendants will be terminated first to prevent runaway processes from arising
- To return all resources that terminate a process to the parent process or system
- PCB removed from the collection
Process blocking and waking events that cause the process to block and wake up
- Request shared resource failed
- Wait for the completion of a certain operation
- New data not yet arrived
- Waiting for new tasks to arrive
Process blocking Process
Call Block Primitive block
- To stop a process from running
- Modify PCB current status is "blocked"
- Insert blocking queue waiting to wake up
Process Wake-up process
Invoke Wake Primitive Wakeup
- To move a process from a blocking queue
- Modify the linear status of the PCB to "execute"
- Insert to Ready queue
Suspend of process and suspension of activation process
Suspend Primitive language suspend
- Check the status of suspended processes
- If active ready, change to still ready
- If active blocking state, then static blocking is changed
- Copy the process's PCB to the specified memory area for easy inspection of its operation
- Move to dispatcher reschedule if process is executing
Process activation process
Activating primitive Language Active
- State transitions are the opposite of hangs
Summarize
- Primitive and operating system kernel
- Creation and termination of processes
- Blocking and waking of processes
- Process suspend and activate
OS-control of the process