Organization of processes: Control blocks, program segments, and data segments

Source: Internet
Author: User

A process is the unit of resource allocation and independent operation of the operating system. It is generally made up of the following three parts.

Process Control block

When the process is created, the operating system creates a new PCB structure, which is then resident memory, which can be accessed at any one time and deleted at the end of the process. The PCB is part of the process entity and is the only sign that the process exists.

When a process is created, the system establishes a PCB for the process, and when the process executes, the system uses its PCB to understand the current state information of the process so that it can be controlled and managed; When the process ends, the system reclaims its PCB and the process dies. The operating system manages and controls processes through the PCB table.

What the PCB typically contains
Process description Information Process Control and management information Resource allocation Checklist processor-related information
Process Identifier (PID) process Current state code snippet pointer Universal Register Value
User Identifier (UID) process priority data segment pointer address register value
  code Run entry address stack segment pointer control register Value
  Program's external memory address file descriptor Flag Register Value
  Enter memory time keyboard status word
  processor Elapsed time mouse  
  semaphore use    


The above table is an example of a PCB, mainly including process description information, Process Control and management information, resource allocation list and processor-related information. The main explanations of the sections are as follows:

1) Process Description information
Process identifier: Flags each process, each of which has one and unique identification number.
User identifier: The user that the process belongs to, and the user identifier is primarily a shared and protected service.

2) Process Control and management information
Process Current state: Describes the status of the process information, as the basis of the processor allocation schedule.
Process priority: Describes the priority of a process preemption processor, and a high-priority process is given priority to get the processor.

3) A resource allocation checklist that describes the status of the memory address space or virtual address space, the list of open files, and the input/output device information used.

4) Processor related information, mainly refers to the processor in the register value, when the process is switched, the processor status information must be stored in the corresponding PCB, so that the process re-execution, can again from the breakpoint to continue execution.

In a system, there are usually many processes, some are in a ready state, some are in a blocking state, and the reasons for blocking are different. In order to facilitate the scheduling and management of the process, the PCB of each process needs to be organized in an appropriate way. At present, there are two kinds of organization methods, such as Link way and index way. Link the same state of the PCB link into a queue, different states corresponding to different queues, can also be in the blocking process of the PCB, depending on the cause of the blocking of the different, into a number of blocking queues. Indexing is a process in which the same state is organized in an index table, the table entry of the index table points to the corresponding PCB, and the different states correspond to different index tables, such as the Ready Index table and the blocking index table.

Program Segment

The program segment is the program code snippet that can be dispatched by the process scheduler to the CPU execution. Note that programs can be shared by multiple processes, which means that multiple processes can run the same program.

Data segment

The data segment of a process can be the raw data processed by the process's corresponding program, or it can be the intermediate or final result when the program executes.

Organization of processes: Control blocks, program segments, and data segments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.