Operating System: Process Control

The main reference herein "computer operating system (fourth edition)" (Xi'an University of Electronic Science and Technology Publishing House) and Tsinghua operating system open class (to Yong, Yu Chen), finishing the basic concepts of the operating system for their own review inspection.

Process Control

Process control is the most basic functions of process management in general by the kernel primitives (Primitive) implementation.

Support functions

The operating system will provide some of the basic functions of other modules required, which contains three basic support functions.

Interrupt processing

Kernel interrupt handling is the most basic function, is the foundation of the entire operating system, many important events in the operating system rely on interrupts, such as: system calls, keyboard input, process scheduling, device drivers.

Clock Management

Is a basic clock management function of the kernel, the operating system clock needs to support many activities, such as: round-robin scheduling.

Primitive operations

Primitive i.e., a procedure for performing a certain function of a number of commands, the most important point is that it is an atomic operation , i.e. substantially inseparable unit. Primitives must not be interrupted in the process of being executed.

Resource management

  1. Process Management
  2. Memory Management
  3. Device Management

Process life cycle

Creation process

The operating system allows a process creates another process.

On UNIX systems, create and be created by this leads to is that the process is the existence of a hierarchical relationship, the process of its descendant processes constitute a family process, PCB contains a family of relational tables, identify yourself as the parent process and all child process.

The level concept does not exist in Windows, all processes have the same status. Particularly, a process can get another process when creating a handle (the Handle) , it is used to control the process of being created, and the handle can be passed. To handle, based on the relationship between the process of simplifying the control relationship with the control.

Cause event creation process

Typically there are four types of events can cause a process creates another process:

  1. User Login: time-sharing system, the system creates a process for the user after successful login;
  2. Job scheduling;
  3. Service: When the user program running made a request, the system will create a special process to provide services;
  4. Application requests: the first three are the system creates a process for the user, and this class is a user process to create their own new process.

Create a primitive

Whenever a request to create a process occurs in the system, the system will call to create a primitive Creat , create a new process by following these steps:

  1. For the new process to apply for a unique numeric identifier, apply blank PCB;
  2. Allocation of resources required for its operation for the new process;
  3. Initializing the PCB;
  4. The new process is inserted into the ready queue.

Termination process

Events that cause the process to terminate

  1. Normal end of that process task has been completed and ready to quit running;
  2. Abnormal end, that process happens if something unexpected occurs during operation, the program can not continue, such as: cross-border wrong, illegal instruction, wrong permissions, run the timeout, timeout wait, wrong operation, I / O fault;
  3. Outside intervention, the variety, such as typical: the operating system intervention, parent request, the parent process is terminated.

Termination of the original language

If the rope system to terminate the process of the event, the system back to the calling process's termination of the original language, and follow the steps to terminate the process:

  1. The process identifier is terminated, the PCB is retrieved from the process set out PCB, read out the state of the process;
  2. If the termination process to be executed in the state, terminates the execution
  3. Terminate its descendant processes;
  4. The process has been terminated all the resources returned to the parent process or operating system;
  5. Where the process will be terminated removed from the queue.

Blocking the wake-up process

Events that cause the process to block and wake

  1. To request a shared resource system failure;
  2. Waiting for a completion of the operation;
  3. New data has not been reached;
  4. Waiting for a new task arrives.

Clog

Obstruction is a proactive behavior . When executing process encounters an event causing obstruction, it will call blocking primitives Block will block itself.

wake

Wake is a passive behavior . When the blocking process is expected events, related back to the calling process will wake wakeup primitives will wait for the process of the wake-up event.

Suspend the activation process

As previously mentioned, the operating system also can be flown and the activation process, the corresponding suspend primitive suspend and activate primitive the Active .

Guess you like

Origin www.cnblogs.com/Li-F/p/11870314.html