MindMap Gallery 2. Process description and control
408 Postgraduate Entrance Examination Collection (Operating System 2), A process is a program with independent functions that runs on a data collection. It is an independent unit for resource allocation and scheduling in the system.
Edited at 2024-03-07 14:42:02This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
Chapter 2 Process Description and Control
Precursor graph and program execution
Program execution concurrently
Concurrent execution of programs
Characteristics of concurrent execution of programs
discontinuity
lose closure
irreproducibility
Description of the process
process definition
A process is an execution of a program
A process is the activity that occurs when a program and its data are executed sequentially on a processor
A process is a program with independent functions that runs on a data set. It is an independent unit for resource allocation and scheduling in the system.
Characteristics of the process
Dynamic
Concurrency
independence
Asynchronicity
Classification from operating system perspective
System process
user process
The difference between process and program
Process is a dynamic concept, while program is a static concept
A program is an ordered set of instructions that will exist forever; a process is an execution of a program on a data set, with creation and cancellation, and its existence is temporary;
Processes have concurrency, programs do not
Processes can create other processes, but programs cannot form new programs
Process is the basic unit that competes for computer resources, programs are not
The relationship between process and program
A process is an execution of a program on a data set
A program is an integral part of a process. One program can correspond to multiple processes, and one process can include multiple programs.
The running goal of a process is to execute the corresponding program
From a static point of view, the process consists of program, data and process control block (PCB)
Basic states and transitions of processes
Three basic states of processes
Ready stateready
Execution status running
blocking state block
Transitions between the three basic states
Creation state and termination state
five-state process model
Notice
The two state transitions, blocking state -> running state and ready state -> blocking state, cannot occur.
Suspended operations and process state transitions
The difference between suspending and blocking
The purpose of the suspend operation
End user needs: Modify, inspect processes
The needs of the parent process: modify and coordinate the child process
The need for swapping: buffering memory
The need for load regulation: ensuring the execution of real-time tasks
key map
Data structures in process management
The role of process control block PCB
As a symbol of the basic unit of independent operation
Able to achieve intermittent operation mode
Provide information needed for process management
Provide information needed for process scheduling
Implement synchronization and communication with other processes
Process control block information
process identifier
External identifier PID
Internal identifier (port)
processor status
general purpose register
instruction counter
Program status word PSW
user stack pointer
Process scheduling information
process status
process priority
Additional information required for process scheduling
event
process control information
Program and data addresses
Process synchronization and communication mechanism
Resource list
link pointer
How process control blocks are organized
linear approach
Link method
Index mode
process control
operating system kernel
Two major functions
support function
Interrupt management
clock management
Primitive operations
Process management is performed by several primitives
Resource management function
Process management
memory management
Device management
state
System state, management state, kernel state
user state, eye state
Creation of process
process hierarchy
parent process
child process
The event that caused the process to be created
User login
job scheduling
Provide services
application request
Process creation process
1. Apply for blank PCB
2. Allocate the new process the resources it needs to run
3.Initialize process block PCB
4. If the process ready queue can accommodate the new process, insert the new process into the ready queue.
process termination
Events that cause process termination
1. End normally
2. Abnormal end
3. External intervention
process termination process
1. According to the identifier of the terminated process
Process blocking and awakening
Events that cause processes to block and wake up
A request for a system service was not fulfilled
Start some operation and block the current process
New data has not arrived yet
No new work to do: system processes
Process blocking process (blocking itself)
Process wake-up process (the system or other processes wake themselves up)
Process suspension and activation
suspend
active
Process synchronization
basic concept
Two forms of constraints
indirect mutual constraints
Mutually exclusive - competition
direct mutual constraints
Synchronization - Collaboration
critical resources
Partition
enter sectionenter section
critical section critical section
exit sectionexit section
remaining area remaining section
Rules that synchronization mechanisms should follow
1. Give in when you are free
2. Wait if you are busy
3. Limited waiting
4. Give up and wait
Process synchronization mechanism
Software synchronization mechanism: None of them solves the problem of waiting for rights, and some methods can also cause deadlocks.
Hardware synchronization mechanism
Turn off interrupts
Implement mutual exclusion using Test-and-Set instructions
Use the swap instruction to implement process mutual exclusion
semaphore mechanism
integer semaphore
record semaphore
Since the integer semaphore does not follow the give-and-wait principle, the record type allows negative numbers, that is, blocking linked lists
AND type semaphore
semaphore set
Understand: AND model wait and signal can only add 1 or subtract 1 to the signal, which means that only one unit of a certain type of critical resource can be applied for or released at a time. When N units are needed at a time, N wait operations must be performed, which is obviously inefficient and may even increase the probability of deadlock. In addition, in some cases, in order to ensure the security of the system, when the number of requested resources is below a certain lower limit, it must be controlled and not allocated. Therefore, when a process applies for a certain type of critical resource, before each allocation, it must test the number of resources to determine whether it is greater than the lower limit that can be allocated, and decide whether to allocate it.
operate
Swait(S1, t1, d1...Sn, tn, dn)
Ssignal(S1,d1…Sn,dn)
Special case
Synchronization issues of classic processes
producer-consumer problem
Philosophers' dining problem
Reader-Writer Problem
process communication
Process communication refers to the exchange of information between processes, also known as low-level process communication
Types of process communication
shared memory system
Communication based on shared data structures
producers and consumers
Communication method based on shared storage area
advanced communications
Pipe communication system (pipe)
advanced communications
messaging system
advanced communications
Method classification
direct communication
indirect communication
Customer service machine – server system
How message passing communication is implemented
direct messaging system
Mailbox communication
Basic concepts of threads
The introduction of threads
The introduction of threads is to simplify communication between threads and improve the degree of concurrency within the process with a small overhead.
Disadvantages of multi-thread concurrency
Two basic properties of processes
An independent unit with resources that can independently allocate system resources
A basic unit that can be independently scheduled and dispatched, the PCB
The time and space overhead required for concurrent execution of programs
Create process
Undo process
Process switching
Inter-process communication is inefficient
Separate the two attributes of resource allocation and scheduling
Thread - as the basic unit of scheduling and dispatch
The process is the unit of system resource allocation, and the thread is the unit of processor scheduling.
A thread represents a control point of a process and can execute a series of instructions. Usually, corresponds to a function of the application
The decomposition of processes into threads also enables efficient utilization of multi-processor and multi-core computers
Comparison of threads and processes
difference
basic unit of scheduling
Concurrency
Similarity
Status: running, blocked, ready
Threads have a certain life span
A process can create threads, and a thread can create another child thread.
Mutual exclusion and synchronization still exist when multiple threads execute concurrently
Thread implementation
How threads are implemented
Kernel supports thread KST
User-level thread ULT
Combination method
Process attributes in multi-threaded OS
A process is a basic unit that can own resources
Multiple threads can execute concurrently
The process is no longer an executable entity
Thread status and thread control blocks
Three states of thread running
Execution status
ready state
blocking state
Thread control block TCB