Chapter 2-Process Management notes (2)

Source: Internet
Author: User

2.2 Process Control

2.21, 2.22

Concepts:

Process control is the most basic function in process management. Creates, terminates, and is responsible for status transition during process running.

Process control is generally implemented by the primitive in the OS kernel.

A primitive is a process composed of several commands used to complete certain functions.

It differs from general processes in that they are "Action operation )". That is, they are inseparable, do not allow interruption, and resident memory.

 

• Process graph is a directed tree used to describe the family relationship of a process.

 

2.2.3 process blocking and Wakeup

1. Events that cause process blocking and Wakeup

The following types of events can cause process blocking or wakeup.

• Request System services (for example, request Printing Services)

• Start an operation (such as an I/O operation)

• New data has not arrived

• No new work available (system processes with certain features, such as sending processes)

 

2. Process Blocking

Unable to continue execution. Block itself by calling the blocking primitive. YesActive Behavior.

• Stop execution immediately

• The current status in the PCB is changed from "executed" to "blocked" and the PCB is inserted into the corresponding blocking queue

• ReschedulingProgramRe-schedule, allocate the processor to another ready process, and switch

(RetainedBlocked ProcessProcessor status (in PCB)And then set the CPU environment according to the processor status in the PCB of the new process ).

 

3. Process wake-up process

When the event expected by the blocked process appears, it will wait for the process to wake up. (For example, I/O completed)

The process of wake-up primitive execution is as follows:

• Remove the blocked process from the blocking queue

• Change the current state in the PCB from blocking to ready, and then insert the PCB into the ready queue.

It should be pointed out that the block primitive and the wakeup primitive are opposite to each other.

Therefore, if a blocking primitive is called in a processThe wake-up primitive must be arranged in another process or in other related processes in cooperation with itTo wake up the blocked process;

Otherwise, it will be blocked for a long time, and thus there is no chance to continue running.

 

 

2.2.4 process suspension and Activation

1. Process Suspension

When a process suspension event occurs (for example, a user process request suspends itself or a parent process request suspends a child process ).

The execution process of the suspend primitive suspend () is:

• First, check the status of the suspended process and perform relevant operations (Execution state, activity ready-static ready; Activity blocking-static blocking ).

• To facilitate the user or parent process to check the running status of the process, copy the PCB of the process to a specified memory area.

• Finally, if the suspended process is being executed, the scheduling program will be rescheduled to reallocate the processor.

 

2. Process Activation Process

When an event of an activation process occurs (for example, a parent process or user process requests to activate a specified process)

Activation primitive active () activation process:

• The activation primitive transfers the process from external memory to memory

• Check the current status of the process and perform relevant operations (static-activity-ready; static blocking-activity blocking ).

If the preemptible scheduling policy is used, every time a new process enters the ready queue,

Check whether re-scheduling is required. That is, compare the priority of the activated process with the current process and determine the processor ownership.

 

 

OriginalArticleIf it is reproduced, please note: transferred from ¥ forgot % windHttp://www.cnblogs.com/slave_wc}

Address: Chapter 2-Process Management notes (2)

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.