Operating system--process management for a single CPU situation

Source: Internet
Author: User

1. Process concept

Process: an executing program; the operating system proposes a process concept purpose: to track the state of a program during execution. And the program is just a piece of code, is a static concept

It is not possible to accurately describe everything that happens when the program executes. The program code is loaded into memory and is present in the form of a process.

2. Composition of the process

Logical address space: This concept is proposed by the operating system, the purpose is to programmers more convenient programming, regardless of the actual memory allocation situation memory management, etc., only appear in the storage of address bus

The address on is the actual physical address, and the address that appears at any other stage is a logical address. The logical address space that the program sees can be much larger than the actual memory space, during process execution

When the CPU needs to be stored, the address mapping process is completed by the OS----the logical address is converted to a physical address.

Execution engine; program code; data; system resources occupied

PCB: Process Control block---is a complex data structure---all the information necessary for the maintainer process to run. When the process is created, the corresponding PCB is created and initialized accordingly, and as the process executes

The operating system needs to maintain the contents of the PCB. The operating system management process is actually the PCB of the management process.

3. Composition of the process PCB

Process identity; process context switch; Process Control information: dispatch information, status, process communication, store information, resource used, process queue information

4. Characteristics of the process: dynamic, concurrency, independence, constraints, emphasizing the independence of processes in a multi-process system, but also the need for cooperation between processes, and restrictions on access to shared resources

5. Status of the process-the main state of the main analysis 3

Note: The precondition is that there is only one CPU situation, multiple processes compete to get CPU execution, get executed

Process creation: Process creation is an already existing process, created by the operating system kernel through system calls, and the process is assigned a PCB and initialized.

Process-ready state: After the process has been created and the corresponding initialization is completed, other resources other than the CPU are obtained, waiting for the CPU to dispatch. The OS manages all processes in a ready state: The PCB of the process is organized into a ready queue.

Process Execution: Select a process from the ready queue to get CPU execution through the CPU scheduling policy set by the OS.

Process blocking: Process in the process of running, due to the need to wait for the sending of an external event, they will be the CPU execution right, itself in the state.

The operating system maintains multiple wait queues based on the event classifications that the process waits for.

6. Transitions between process states:

Ready state-run state: New process is CPU-dispatched

Run state-ready state: CPU is allocated to the process of time slice ran out

Run to-block state: The process waits for an external event to occur, discards the CPU execution, and the CPU needs to make a new dispatch

Blocking state--ready state: The blocked process waits for an external event to occur, is awakened, and enters the ready queue

Note: When scheduling, the scheduler determines which processes are newly scheduled, and then requires a process context switch: Enter the OS kernel state, save the execution state of the last process (register value, etc.),

Loads the state of the new dispatch process and, when completed, gives the CPU execution to the process that will be executed. The state of the process is stored in the kernel stack of the process in the OS kernel.

As the process's execution state changes constantly, the process of operating system management is essentially migrating the PCB between several queues.

  

7. Process classification by operation

IO-bound processes: Most of the time, processes that require IO operations, interacting with the user, have a very short time to actually use the CPU, and if the process is prioritized: these processes should have high priority

CPU-bound processes: Usually a process that is computationally intensive, infrequently interacting with the user, which takes longer CPU time, but does not have a strict time-to-complete limit, setting a low priority

8.CPU Scheduler: An algorithm whose function is to select a process in the ready queue, complete the process context switch, and let the process be executed by the CPU.

CPU Scheduling Policy classification: Non-preemptive: the current process is executing, the ready queue to a higher priority process, the current process will continue to execute until the CPU execution is voluntarily discarded.

Preemptive: The current process is executing, the ready queue to a higher priority process, the current process is forced to give up the CPU, higher priority processes are dispatched.

  

Operating system--process management for a single CPU situation

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.