Process scheduling algorithm for operating system

Source: Internet
Author: User

Measurement of scheduling performance user-facing Short turnaround times

Turnaround time, which is the interval at which the job starts from the submission system until the job is completed. Turnaround time Breakdown includes:

    1. The wait time for the job in the external memory fallback queue
    2. Wait time for the corresponding process created after the job has been transferred into memory in the ready queue
    3. Time the process was executing on the CPU
    4. The time that the process waits for certain operations to complete

Where 2, 3, 4 can occur multiple times throughout the process of a job.

The weighted turnaround time refers to the ratio of the job turnover time to the actual operating service time. Average turnaround time and average weighted turnaround time are important criteria to measure the scheduling algorithm of batch processing system .

Fast response times

Response time, starting with the user submitting the request, to the time interval until the system first responds. is an important criterion for measuring time- sharing system scheduling algorithm.

guarantee of the cut-off time

Start deadline, which is the latest time a task must start executing. Completion deadline refers to the latest time a task must be completed. For a more rigorous real-time system , the scheduling algorithm tourmaline does this, otherwise serious consequences.

Priority

Batch processing systems, time-sharing systems, and realtime systems can prioritize higher-priority jobs.

System-oriented High System Throughput

System throughput, the total amount of work that the system can accomplish in a unit of time, which is related to the length of the job in the batch processing system. Short job execution times are short, throughput is high, and long jobs are reversed.

CPU Utilization balanced use of resources time associated with scheduling
    • Service time: The time the job needs to run
    • Time to complete = start time + Service time
    • Wait time = start time-commit time
    • Turnaround time = Finish Time-commit time
    • Take Ownership turnaround time = turnaround time/service time
    • Response ratio = (wait time + service time)/service time = wait Time/service time + 1
Scheduling Algorithm First come first serve

The first-come-first-serve scheduling algorithm (firstly Come-Served, FCFS) is the simplest scheduling algorithm that can be used for job scheduling and process scheduling. Select the job according to the order in which the job enters the system fallback job queue, join the ready queue, and wait for execution.

Example: Assume that there are 4 jobs in the system, the arrival time is 8, 8.5, 9, 9.5, the service time is 2, 0.5, 0.1, 0.2,FCFS scheduling:

FCFS is non-preemptive, easy to implement, low efficiency, poor performance, good for long jobs (CPU busy) and not conducive to short jobs (I/O busy).

Short Job First

The short job first scheduling algorithm, called short process first, is used for process scheduling, which can be used for both job scheduling and process scheduling.

In job scheduling, the algorithm picks up one or several jobs with the shortest estimated service time from the fallback job queue, transfers them into memory, allocates the necessary resources, creates the process and puts it into the ready queue. The principle is similar in process scheduling.

Example: Assume that there are 4 jobs in the system, the arrival time is 8, 8.5, 9, 9.5, the service time is 2, 0.5, 0.1, 0.2,SJF scheduling:

SJF is non-preemptive, takes precedence over short jobs, has good performance, reduces average wait time, and improves throughput. However, it is not conducive to long work, long-running operations may have been in a waiting state, the emergence of hunger, completely without regard to the priority of the job, not for real-time systems .

Shortest remaining time preferred

SJF itself is non-preemptive, for preemptive scheduling system, the corresponding algorithm Chen Wei shortest remaining time priority scheduling algorithm.

The algorithm first picks up the shortest job run according to the service time of the job, and when the job runs, the preemption occurs when a new job arrives at the system and the service time of the new job is shorter than the remaining service time of the currently running job; otherwise, the current job continues to run. This algorithm ensures that once a new short-term job or short process enters the system, it can be processed quickly.

Example: Assume that there are 4 jobs in the system, the arrival time is 8, 8.5, 9, 9.5, the service time is 2, 0.5, 0.1, 0.2,SJF scheduling:

Due to frequent preemption and process switching, the system overhead is high, the algorithm is expensive and is generally used in real-time system.

High response ratio preferred

The high response ratio priority scheduling algorithm (highest reponse Ratio first, HRRF) is non-preemptive and is mainly used for job scheduling.

Basic idea: Each time the job scheduling, the backup job queue to calculate the response ratio of each job, select the highest job input system operation.

Response ratio = (wait time + service time)/service time = wait Time/service time + 1

Example: Assume that there are 4 jobs in the system, the arrival time is 8, 8.5, 9, 9.5, the service time is 2, 0.5, 0.1, 0.2,SJF scheduling:

The response ratio analysis shows that the algorithm is between FCFS and SJF, but each time it needs to calculate the response ratio of each job, the system overhead is increased.

Priority Level

One or several of the highest priority levels are selected each time, and can be used for job scheduling and process scheduling. It is divided into non-preemptive and preemptive type.

Time Slice rotation

Process scheduling for time- sharing systems .

Basic idea: The system divides the CPU processing time into several time slices (q), and the process is arranged in the order of arrival. Each schedule selects the first process, after executing 1 time slice Q, the timer sends out the clock interrupt request, the process moves to the tail of the queue. This is true for each subsequent dispatch. The algorithm can respond to all users in a given time and request, to achieve the purpose of timeshare system .

Its performance depends mainly on the size of the time slice Q, q is too large, then all the process in 1 time slices to complete, back to the peripheral fcfs; too small the process frequently switch, the system overhead.

The algorithm is simple and effective, often used in time-sharing system, but is not conducive to frequent and compact I/O, because this process is not enough to use a chip, because of waiting for I/O operation is blocked, when the I/O operation ends, can only be inserted into the end of the ready queue, waiting for the next round of scheduling.

Reference
    1. Quiet, principles of computer operating system, Wuhan University Press
Directory

    • Measurement of scheduling performance
      • User-facing
        • Short turnaround times
      • Fast response times
      • Guarantee of the cut-off time
      • Priority
    • System-oriented
      • High system throughput
      • CPU utilization
      • Balanced use of resources
    • Time associated with scheduling
    • Scheduling algorithm
      • First come first serve
      • Short Job First
      • Shortest remaining time preferred
      • High response ratio preferred
      • Priority level
      • Time Slice rotation
    • Reference
    • Directory

Process scheduling algorithm for operating system

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.