Operating System - Process Description

  Process activity is achieved by executing a series of programs on the cpu and the corresponding data operations, data and processes are operating existing process entities, programs and data are static code and text, does not reflect the process dynamic. For this purpose, a current status and characteristics data structure to describe the process, this data structure is called a process control block (PCB) (referred to in the linux task-struct, will be described hereinafter).

 

Process control block pcb

  pcb contains a description of the process of information, control information and resource information, some systems of protected areas as well as on-site process scheduler waiting to be used. When concurrent execution process, due to the need to share resources, mutual restraint between the various processes, in order to reflect these relationships and sharing relationships resources constraints, when a process is created, it should create pcb, pcb and then based on the information in the process of implementing effective management and control. When a process to perform its function, the system will release the pcb, mark the demise of the process.

  pcb recording information in the process control functions can be divided into four sections: a process identifier, the processor status, process scheduling information, process control information.

1, process identifier:

  The process identifier used to uniquely identify a process, a process usually has two identifiers

  Internal (1) process identifier. In all operating systems, giving a unique numeric identifier for each process, usually the serial number of a process. The main internal identifier for the convenience of the operating system

  External (2) process identifier. It has provided the creator is usually composed of letters, digits. Often used by the user in the process of access time. In order to describe their family relationships, but also set the parent process identifier and the child process identifier.

2, processor status:

  The contents of processor status information from the various registers in the processor of the composition, the processor at run time, a lot of information in registers. When the processor is interrupted, this information must be stored in the pcb, so that the process from the breakpoint in the re-run to continue.

  pcb has specialized in the field of cpu protection structure to store the data of exit-site execution.

3, the process of scheduling information

  (1) process status. Indicate the current state of the process, as the basis for process scheduling and exchange of

  (2) process priority. Priority is used to describe the process of using a processor, a high priority should be given priority process cpu.

  Additional information (3) the process of scheduling needs. This is the process used by the scheduling algorithm related, as the process has been waiting cpu time the process has been running time, etc.

  (4) events or blocking reasons. Refers to the process of transition from execution is in blocking state events waits.

4, process control information  

  Process control information includes:

  (1) and the address of the program data. Memory or external memory address when referring to the process of programs and data reside, in order to re-schedule the execution process, from the pcb find other programs and data

  (2) process synchronization and communication mechanisms. It refers to the process of achieving the necessary synchronization and interprocess communication mechanism, such as a message queue pointer, semaphores.

  (3) a list of resources. In addition to a list of cpu, and all the resources needed to process and a list of resources allocated to the process.

  (4) link pointer. The first gives the address of the next process of this process pcb pcb where the queue.

 

 

Process control block organization:

  In order to effectively manage the process, and often the processes of the pcb organized in a suitable way. General pcb organization has a linear fashion, chaining and indexing.

 1, in a linear manner

  The simplest, easiest way to achieve. Operating system make sure the system the maximum number of simultaneous processes and statically allocated space. All processes pcb are placed in this table. The main problem with this approach is limited to a maximum number of systems exist in the process, when the number reaches the upper limit of the process can not create a new process, more serious shortcoming in the implementation of cpu scheduling, it often needs to scan the entire table, serious affect scheduling efficiency.

 

 

  

2, chaining

  Principle way links are in different states of the process are to be placed in different queues. But under the cpu state, the process is running only one, you can use a pointer to its pcb. Processes in the ready state, there are a number, they are arranged in one or more queues, through the internal structure of the pcb pcb same link pointers to link the queue. Pcb of the first queue pointed to by the ready queue pointer, the last link pointer pcb is 0, indicating the end. the first cpu scheduler pcb off from this queue, allowed to put into operation, the newly added ready queue in accordance with a scheduling algorithm pcb is inserted. Queue may have a plurality of blocking, blocking each corresponding to a different reason. When the condition is met to wait for some time, you can put on the pcb correspond blocked queue to the ready queue, running processes if the absence of certain resources and unmet occurs, the state becomes blocked, adding the appropriate blocking queue. linux operating system is the application of process control block this organization

 

 

3, indexing

  The system established in accordance with the state of progress of the index table, such as Ready index table, blocking index table, etc., and put each index table in the first memory address of record in some of the specialized cells in the memory. Each index entry in the table, the recording state of a pcb having a corresponding address in the table pcb.

 

 

 

pcb linux process

  linux system process called task. Process of the system control block structure for a pcb called task-struct described. pcb Linux system contains the following information.

1, process descriptions

  By process descriptions, linux system can uniquely identify the basic situation of a process. Learn the process belongs to users and user groups, etc., and can determine the relationship between the process and other processes, the description information includes process number, user and group identification and description of the process of the family link information

2, process control information

  (1) the current state of the process

  (2) the scheduling information. Recording process priority

  (3) information referred

  (4) the communication information. linux unix support typical inter-process communication mechanism - signal, pipes, also support communication mechanisms systemV - shared memory, message queues and semaphores.

3, process resource information

  The process of recording a variety of information resources addresses, file systems and processes related to memory and open file information

4, cpu site information

  Through the operation of task-struct, the system allocates resources to carry out the process to create a schedule to finalize the process of withdrawal and

Guess you like

Origin www.cnblogs.com/LEEYATWAH/p/11791664.html