Process management (f) - description of the process

Process management (f) - description of the process

  • Process control block: a PCB process is the only entity that processes sensing system
  • Block: Describe the process to be completed function
  • Data collection program operation: programs essential in the implementation of the work area and manipulating objects

PCB

What is PCB

PCB contains descriptive information about the process, control information and resource information, reflects the dynamic characteristics of a process.

PCB role

1. The system according to perceived changes in the presence of PCB process variables and the PCB contained by the master process control in order to achieve a state in which the activities of the process object.

2. PCB structure is a process all or part of resident memory.

PCB lifecycle

When creating a process, which first create PCB, and the PCB in accordance with information to implement effective management and control of the process.

When a process to perform its function, the system releases PCB, the process also will die.

PCB content comprising

Description

1. process name or process ID No.
2. The user name or user identification number
3. familial relationships: Each process must have a parent process; can have zero or more child processes.

Control information

1. The current state of the process
2. Process Priority
3. The program start address
4. The various timing information: Process possession and use of resources of the situation.
The communication information: the process execution information exchange with other processes where

Resource Information

1. The memory space and management data structure pointer, for example, as described later, the memory management process used in the page table pointer and the like.
2. In some complex systems, as well as exchange of information or the covering panel, such as changing the length of the block, the external memory address swapping. In the application process, when used to release memory
3. The shared block size and a start address of
4. The device number of input and output devices, the data structure pointer data length to be transferred, the address buffer, the buffer length and the like of the equipment used. In the process of applying the release of the data transmission apparatus using
a pointer pointing to 5, and identifying the file system and the like.

CPU-site protection structure

The process of waiting for an event or enter a waiting state due to some events were discontinued in the machine to perform, in order to resume the process after execution is interrupted, the need to protect the current process CPU-site (also known as the process context ).

PCB size

A PCB table generally comprise hundreds to thousands of bytes (PCB per 1KB about the Linux system much memory space).

Some systems in order to reduce the amount of memory occupied by the PCB, the PCB only part of the most commonly used, such as CPU site protection, the process descriptor information, control information, etc. permanent memory. The other portion of the PCB structure in the external memory is stored in, the process will be loaded into memory to be executed along with other data.

Organization

Linear fashion

Description: The system all PCB are organized in a linear table, the first table address stored in a dedicated area of memory

Features : The way to achieve simple, low overhead, but they need to scan the entire table every time you look, therefore suitable for the small number of process systems.

Link mode

Description: The PCB has the same state by the process of the PCB linked into a link word queue, the ready queue is formed, and a plurality of blocking queue empty queues.

Sort Priority:

Ready queue:

The PCB has the same state by the process of the PCB linked into a link word queue, the ready queue is formed, and a plurality of blocking queue empty queues.

Blocking queue:

In the blocked state of the process according to the different PCB causes obstruction, arranged in a plurality of blocking queue, such as waiting queues I O operation to complete and / waiting queue allocated memory and the like.

Indexing

description:

Depending on the status of all processes, the establishment of a few index table, for example, the index table is ready, blocked the 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 address of a PCB having respective states.

Process context

What is the process context

Process context is an abstract concept, comprising the process executed, execution of instructions and data to be executed and, in the instruction register, stack (the return point subroutine calls and parameters) stored in the status word register or the like content.

Process context includes

  • Above: the process has been executed instructions and data.
  • Body: executing process instructions and data.
  • Below: Process data and instructions to be executed.

Context of the process of constitution

  • Values ​​of various registers and processes related to the implementation of the
  • Machine instruction set of codes compiled after block formation
  • Data sets and various stack structure composed of the value of PCB

UNIX context

User context

  • User block part of the process of compiling the text from the user segment
  • User data
  • User stack and so on.

Register context

  • Program register PC (next instruction address)
  • Processor status word register PS (hardware state)
  • The stack pointer (next address) and a general register value (parameter) Composition

System-level context

Static part
  • PCB structure
  • The virtual address space is mapped to process about core stack and forms a space for physical (system call sequence of calls to be used in the process of loading)
Dynamic part

When the dynamic part refers to the entry and exit levels of different contexts, system register values ​​associated with the respective layers in the context save and restore the record, the change rule is satisfied after the advanced mode stack, each stack in each of the context hierarchy per item.

Process context switch

Process space

What is the process space

Either the process has its own address space, called the process space or virtual space.

The size of the process space

The size of the process space only on the number of bits processors. For example, 16-bit processor to process space 216, and the 32-bit processor to process space 232.

Execution within the process space program

Execution of the program carried out in the process space. Various control forms the user program, according to a certain process so the structure arranged in the process space.

Division process space

User space

User program execution in the user space

System space

The operating system kernel program execution in the system space.

Two execution modes

To prevent users from accessing the system program space, causing an access error, the system program status registers, set different execution modes, user mode (user mode), and system mode (system state) to be protected.

Guess you like

Origin www.cnblogs.com/mengxiaoleng/p/11617871.html