Operating system – Process management

Source: Internet
Author: User

Process Concepts

Process: The basic unit of requesting resources and scheduling resources, a process is a process of running a program. is a dynamic concept, in different operating systems, there will be different processes appear.

Program: Static concept, is a collection of instructions and data, can be stored for a long time.

Process-to-program correspondence:
-a program can correspond to one process or multiple processes
-a process can correspond to a program, or a program

Process structure

Process by program, data collection, Process control block PCB
PCB, process created at the time of creation. At the end of the process, the PCB is removed.

Status of the process state conversion process:
    • New state: The process has been created but not accepted as an executable process by the OS
    • Ready state: Ready to execute
    • Execution Status: Occupancy processor (in a single processor environment, only one process occupies a processor at a time)
    • Blocking state: Waiting for a certain time to occur before execution, such as waiting for I/O completion
    • Termination Status: Released by OS from execution state due to stop or cancel
Hang Up concept

Pending: The operating system swapped the process out of memory, which we call a process hang.
five-state transitions:

Five-state queue model scheduling:

The two execution modes of the Process Control process:

System mode (System State): has the highest privilege to run system-specific instructions.
User mode (user state): Lower privilege, user typically running in user mode

Process switching and Mode switching

Process Switching : an operation that acts between processes. The process is referenced when the dispatcher reclaims the current process's CPU and is ready to assign it to a ready process.
mode switching : An operation that is referenced internally by a process. The operation is called when the user program is transferred to a system call, or vice versa.

Process scheduling

process scheduling : In a queue, according to a certain method (algorithm), the process of selecting an appropriate individual.

Scheduling target

Scheduling target: Fairness, processor utilization, improve system throughput, minimize process response time.

Process scheduling – System-oriented principle priority

Priority : The queue can organize different ready queues depending on the priority of the process. When a process is dispatched, the process in the high priority queue is selected first, and the process in the lower priority queue is selected when the high priority queue has no process.


Process scheduling Mode deprivation mode

Deprivation: The time slice has arrived, the process is deprived; there are new priority high-process insertions.

Non-deprivation mode

Non-deprivation: the execution process only interrupts its execution, releases the processor, and then the new process, only when execution is complete, or if the application I/O blocks itself.

Process scheduling type long-range scheduling

Long-range Scheduling: Also known as job scheduling, it creates a process for a scheduled job or user program, allocates the necessary system resources, and inserts the created process into the ready queue for short-haul scheduling. Or insert the newly created process into the ready/Suspended queue, waiting for the medium-range queue.

Medium-Range Dispatch

Medium-range Dispatch: A part of the swap function between the internal and external storage. When the memory space is tight, swap the in-memory process to external memory suspend, and when the memory is idle, swap the suspended process in external memory to memory.

Short-Range Dispatch

Short-range Scheduling: Also known as process scheduling, which process in the ready queue will get the processor.

The process scheduling algorithm first comes first service algorithm: (suitable for long-range, intermediate, short-haul scheduling)

The method is sorted according to the order in which the process arrives, each scheduling the first process.

Short process first algorithm: (for long-range and short-haul scheduling)

When a scheduling process is required, the shortest possible execution time is calculated by calculating which process in the ready queue, whichever is the shortest.

Time slice Rotation scheduling method: (for short process scheduling)

Is the way in which the rotation between the various processes is scheduled within the same time slice.

Priority-based scheduling algorithm

Define a priority for each process, the higher the priority of the process, will take precedence to get the processor scheduling. (This algorithm can be used in conjunction with the above-mentioned time-slice rotation method to perfect each other)
static priority : once determined, the priority of the process is not changed during the run.
Dynamic Priority : The system first assigns the process an initial priority, which changes as the process runs. (The shortest time remaining is preferred, the response ratio is preferred)

Shortest remaining time priority: the shorter the remaining time of the process, the higher the priority
High response priority: The longer the process (expected execution time), the lower the priority, and the higher the priority as the process waits longer

Feedback scheduling algorithm

The feedback scheduling algorithm is a scheduling method based on the process execution history, which combines the idea of time-slice rotation scheduling.
Scheduling Order: First place the process in the first ready queue. If the process cannot be completed in this queue, the process is moved to the next ready queue for execution.

question : Why do you want to set different time slices in different queues?
Because, there is no process completed in the previous level team, it shows that it needs to run more time. We put it in the next level queue, and provide a larger time slice, which can reduce processor memory swap out, improve system efficiency.
question : Where do I need to invoke a new process after a process has finished running?
From the first ready queue, call the new process. When a new process is called, we select the high priority process to call first.

Operating system – Process management

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.