OS-control of the process

Source: Internet
Author: User
Tags terminates

OS--Process Control new Template small book Carpenter reference

"Computer Operating System" (fourth edition) Tang Xiaodan and other authoring

Concept Introduction Process Control

Process Control is the most basic function, responsible for creating processes, ending processes and other functions, generally by the OS kernel primitives to implement

Primitive language

The so-called primitive language, is composed of a number of instructions, used to complete a certain function of a process, is an inseparable, the most basic operation

Note

    1. The primitives are then used basically for all the operations
Operating system kernel

The operating system will have some commonly used or high-frequency modules (such as clock management, process scheduling, etc.) resident memory, which is known as the OS kernel

Two major functions
    1. support function

      • interrupt handling
      • Clock management
      • primitive Actions

    2. Resource management function

      • process Management
      • memory management
      • Device Management
Hierarchy of process creation process

A process can create another process that forms the relationship of the parent and child processes

Note

    1. Process cannot deny inheritance of child processes
    2. When the parent process is revoked, the child process also has to be over
    3. Depending on the parent-child process, you can form a tree of processes
    4. window, when a process creates another process, it obtains a handle that forms a control-and-control relationship
Events that cause the creation process
    1. User Login
    2. Job scheduling
    3. Provision of services
    4. App Request
Creation of processes

Calling a process to create primitive language creat

    1. Request a blank PCB (Process Control block) to obtain a unique numeric identifier
    2. Resources required for the allocation process
    3. Initialize PCB
    4. When allowed, insert the ready queue
An event that causes a process to terminate when a process terminates
    1. normal end

      • out of bounds error: Store beyond process access
      • Protection Error: The process is attempting to access a resource or file that cannot be accessed
      • illegal directive: Access a nonexistent instruction
      • run timeout
      • Wait Timeout
      • arithmetic operation error
      • I/O fault
    2. external intervention

Note: The most typical kind of Ctrl + C bar

The process of terminating a process

Call into Terminate primitive

    1. Retrieves the PCB of the process from the PCB collection based on the identifier of the process, reading the process status
    2. If the process is still executing, immediately terminates execution of the process, and the collocated dispatch flag is true, indicating that the process should be dispatched after it has been terminated
    3. If the process also has a descendant process, the process of its descendants will be terminated first to prevent runaway processes from arising
    4. To return all resources that terminate a process to the parent process or system
    5. PCB removed from the collection
Process blocking and waking events that cause the process to block and wake up
    1. Request shared resource failed
    2. Wait for the completion of a certain operation
    3. New data not yet arrived
    4. Waiting for new tasks to arrive
Process blocking Process

Call Block Primitive block

    1. To stop a process from running
    2. Modify PCB current status is "blocked"
    3. Insert blocking queue waiting to wake up
Process Wake-up process

Invoke Wake Primitive Wakeup

    1. To move a process from a blocking queue
    2. Modify the linear status of the PCB to "execute"
    3. Insert to Ready queue
Suspend of process and suspension of activation process

Suspend Primitive language suspend

    1. Check the status of suspended processes
      • If active ready, change to still ready
      • If active blocking state, then static blocking is changed
    2. Copy the process's PCB to the specified memory area for easy inspection of its operation
    3. Move to dispatcher reschedule if process is executing
Process activation process

Activating primitive Language Active

    1. State transitions are the opposite of hangs
Summarize
    1. Primitive and operating system kernel
    2. Creation and termination of processes
    3. Blocking and waking of processes
    4. Process suspend and activate

OS-control of the process

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.