1. Process
A process is a running activity of a program with certain independent functions, and it is also the smallest unit of resource allocation.
2. Organization of the process
2.1 Linear way
All PCBs are organized in a linear table, and the first address of the table is stored in a dedicated area of the memory. Each search needs to scan the entire table, which is suitable for a small number of processes in the system.
2.2 Link method
The PCBs with the same state are linked into a queue with the link words in them, and the PCBs are stored in a continuous storage area.
2.3 Index method
The first address of each index table in the memory unit is also recorded in a dedicated unit in the memory, and the address in the PCB table of a certain PCB in a corresponding state is recorded by adding an index table.
3. Process conversion
3.1 Three-state model
The entire life cycle of a process from creation to revocation and death can be characterized by a set of states. According to the three-state model, the life cycle of a process can be divided into the following three process states:
1. Running:
2. Ready state (ready): has the running conditions, waiting for the system to allocate the processor to run 3.
Waiting state (blocked): does not have the running conditions, is waiting for the completion of an event
The process in the running state will enter the waiting state due to the occurrence of the waiting event. When the waiting event ends, the process in the waiting state will enter the ready state, and the scheduling policy of the processor will cause the switching between the running state and the ready state.
The specific reasons for the process state transition are as follows:
- Running state—→waiting state: waiting to use resources; such as waiting for peripheral transmission; waiting for manual intervention.
- Waiting state—→ready state: resources are satisfied; such as the end of peripheral transmission; manual intervention is completed.
- Running state - → ready state: the running time slice is up; there is a higher priority process.
- Ready state—→running state: select a ready process when the CPU is idle.
3.2 Five-state model
In an actual system, the state of the process and its transitions are more complicated than those described in the previous section, such as the introduction of special
new states (new) and termination states (exit).
The state transition diagram is shown below:
The build state corresponds to the state in which the process has just been created. Creating a process is a two-step process,
1. creating the necessary management information for a new process,
2. making the process ready. At this point, the process will be in a new state, it has not been submitted for execution, but is waiting for the operating system to complete the necessary operations to create the process. It should be noted that the operating system will sometimes delay the submission of new ecological processes based on system performance or main memory capacity constraints.
The specific reasons for the process state transition are as follows:
- NULL—→New state: Execute a program and create a child process.
- New state—→ready state: When the operating system has completed the necessary operations for process creation, and the current system performance and virtual memory capacity allow it.
- Running state - → Termination state: When a process reaches the natural end point, or an insurmountable error occurs, or it is terminated by the operating system, or it is terminated by other processes that have the right to terminate.
- Termination state—→NULL: Complete the aftermath operation.
- Ready State - → Terminated State: Not shown in the state transition diagram, but some operating systems allow the parent process to terminate the child process.
- Waiting state - → Terminating state: Not shown in the state transition diagram, but some operating systems allow the parent process to terminate the child process.
4. How processes are scheduled
Different from other operating systems, after installing the Linux system, some office software, graphics processing tools, multimedia playback software and network tools commonly used by users do not need to be installed. For program developers, Linux is a good operating platform. The Linux software package includes a variety of programming languages and development tools, such as gcc, cc, C++, Tcl/Tk, Perl, Fortran77, etc. .