Scheduling algorithms in the operating system

Source: Internet
Author: User

First, Process (Job ) scheduling algorithm

1. First come first service scheduling algorithm (FCFS): Each time the dispatch is from the Ready queue, select a process that first enters the ready queue, the processor is assigned to the process, so that it can be executed. Once the process takes possession of the processor, it runs until the process finishes or blocks because of an event, before exiting the processor. Characteristics: Beneficial to the long process, but not conducive to the short process.

2. short process (Job) Priority scheduling algorithm (SPF): It selects a process from the ready queue that estimates the shortest running time, assigns the processor to the process, takes possession of the processor, and executes until the process completes or blocks because of an event. Then quit the processor and reschedule.

3. time-slice rotation scheduling algorithm : The system arranges all ready processes in the order in which they enter the ready queue. Each time the scheduling of the CPU assigned to the first process, let it execute a time slice, when the time slice run out, by the timer clock interrupt, the scheduler pauses the execution of the process, so that it exits the processor, and send it to the end of the ready queue, waiting for the next round of scheduling execution.

4. Priority scheduling algorithm : It selects one of the highest priority processes from the ready queue to get the processor and execute it.

5. Response to high- priority scheduling algorithm : It selects a process from the ready queue with the highest response, allowing it to get processor execution until the process finishes or exits the processor as a result of waiting for an event. Features: Not only take care of the short process, but also consider the order of the process arrival, will not make the long process is not long-term service, it is a more comprehensive consideration of the algorithm, but each time the scheduling, each process needs to calculate the response ratio. Therefore, the system overhead is very large, more complex.

6. Multilevel queue scheduling algorithm

Basic concepts:

Job turnaround time (Ti) = Finish time (Tei)-Submission time (Tsi)

job average turnaround time (T) = turnaround time /number of jobs

job with right turnaround time (Wi) = turnaround time /Run time

response ratio = (wait time + run time)/run time

Partition allocation algorithm in memory continuous allocation method

1. first-time Adaptive allocation algorithm (FF): The requirements for the records of an idle partition table are in ascending order of addresses , and each time the allocation is made, the free partition table is always searched from the beginning of the first 1 records. Find the first idle area that satisfies the job length requirements, split the idle area, part of the assignment to the job, and the remaining part of the idle area.

2. cyclic first-time adaptation algorithm : Each assignment starts after the last assigned location.

3. Optimal Adaptive Allocation Algorithm (BF): is to choose from all the free partitions according to the job requirements of a minimum idle area to meet the requirements of the job, so as to ensure that a larger area is not separated, so that when loading large jobs is easier to be satisfied. In order to implement this algorithm, the idle area is registered in the table of the idle area in ascending order of length, and is searched sequentially when assigned.

4. worst-fit algorithm (worst fit algorithm): requires the idle area to form a free-area free-form table or chain in descending order of size . When a user job or process requests a scratch area, first check that the size of the available table or free chain in the free zone is greater than or equal to the required memory length, and the allocation fails if the number of idle extents shown in the first item of the available table or free chain is less than required. Otherwise, allocate the appropriate storage space from the available table or free chain in the free zone to the user, and then modify and adjust the available table or free chain for the free area.

Third, the page replacement algorithm

1. Best Replacement algorithm (OPT) : Select a memory page that will never be used in the future or that is no longer accessed in the longest period of time.

2. First-in-Advance permutation algorithm (FIFO): Select the first page to enter the memory to be eliminated.

3. The most recent unused algorithm (LRU): Choose a page that has been unused for the longest time in a recent period and retire it.

4. Least-use algorithm (LFU): Select the page conversion that is least visited by the current time.

Four, disk scheduling

1. First come first served (FCFS): The disk drives are started in the order in which they are requested, regardless of the physical location they want to access

2. Shortest seek time First (SSTF): Let the requesting visitor, who is closest to the current track, start the disk drive, that is, the job that takes the shortest time to find is executed first, regardless of the order in which the visitor arrives. This overcomes the problem that the magnetic arm moves too large in the first-come-first service scheduling algorithm.

3. Scanning algorithm (scan) or elevator scheduling algorithm: always start from the current position of the magnetic arm, along the direction of the magnetic arm to select the nearest cylinder of the current magnetic arm visitors. If no access is requested along the direction of the magnetic arm, the direction of movement of the magnetic arm is changed. In this scheduling method, the movement of the magnetic arm is similar to the dispatch of an elevator, so it is also called the elevator scheduling algorithm.

4. Cyclic scanning algorithm (cscan): The cyclic scanning scheduling algorithm is improved on the basis of scanning algorithm. The magnetic arm changes to a single movement, by the outward. The current position begins to select the visitor of which cylinder is closest to the current one, along the direction of the magnetic arm movement. If there is no request to access along the direction of the magnetic arm, then back to the most, the job request to access the minimum cylinder number.

Scheduling algorithms in the 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.