0% found this document useful (0 votes)
20 views4 pages

Osc 7

The document discusses different CPU scheduling algorithms including round robin, first come first serve, shortest job first, and priority scheduling. It describes the aims of CPU scheduling as fairness, efficiency, response time, turnaround time, and throughput. It also covers preemptive versus non-preemptive scheduling and provides details on some common scheduling algorithms.

Uploaded by

xx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Osc 7

The document discusses different CPU scheduling algorithms including round robin, first come first serve, shortest job first, and priority scheduling. It describes the aims of CPU scheduling as fairness, efficiency, response time, turnaround time, and throughput. It also covers preemptive versus non-preemptive scheduling and provides details on some common scheduling algorithms.

Uploaded by

xx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Aim of CPU Scheduling

1. Fairness
- to make sure all processes get a fair share of the CPU time
- to avoid starvation
2. Efficiency
- to maximize CPU utilization and keep the CPU busy close to 100% of the time
3. Response time
- to provide consistent response time
- to minimize response time
4. Turnaround time
- to minimize time between submission and job completion
5. Throughput
- to maximize the number of jobs completed within a given time period
Two types of CPU Scheduling

Preemptive Scheduling
• Allows for processes running to be temporarily suspended
• Processes releases CPU upon receiving a command from the operating system

• Pre-emptive scheduling algorithms:


- Round Robin (RR)
- Multilevel Queue (MQ)
- Multilevel Feedback Queue (MFQ)

Non-Preemptive Scheduling
• Processes releases the CPU only after completion

• Processes releases CPU voluntarily

• Non-preemptive scheduling algorithms:

- First Come First Serve (FCFS), or First In First Out


(FIFO)
- Shortest Job First (SJF)
- Priority
1. Round Robin
• The oldest, simplest, fairest and most widely used algorithm
• Designed for time-sharing systems
• A time quantum / time slice is defined for each process
• The ready queue is treated as a circular queue
• To implement round robin, the ready queue is kept as a first in first out queue

2. First Come First Serve (FCFS/FIFO)


• The simplest CPU scheduling non-preemptive algorithm
• A process that requests for the CPU first is allocated the CPU
• The implementation of the FIFO policy is easily managed with a FIFO queue
• The average waiting time for FIFO is quite long
• Once the CPU has been allocated for the process, the process keeps the CPU
• until termination or by requesting for I/O

3. Shortest Job First (SJF)


• Scheduling is done by examining the length of the next CPU burst of a process
• If the CPU is free, the next process with the smallest CPU burst time is assigned
• If two processes have the same CPU burst time, FIFO is used to break the tie
• The difficulty with SJF is to determine the length of the next process
• The advantage of this algorithm is that it is optimal; providing minimum average waiting time

4. Priority
• Priority is associated with each process
• The CPU is allocated to a process with the highest priority
• Equal priority processes are scheduled using FIFO
• Priority can be high or low; however, 0 can mean high priority
• Can be preemptive or non-preemptive
• A problem with priority algorithm is starvation
• Aging is a technique used to gradually increase the priority of a
process
TT =
Tw+TB
Algorithm 1 - Round Robin
• The average waiting time is usually long

• Performance depends on the size of the time quantum/slice (10 – 100 milliseconds)

• Process switching requires time; the time quantum clock is already running

• Time quantum which is set to short would result in to many process switches and this reduces CPU efficiency

• Time quantum which is too long would cause poor response to short interactive request (would result to
FIFO)

Algorithm 2 - Multilevel Queue


• Classifies processes into different groups

• The ready queue is separated into several separate queues

• Each process is permanently assigned to one queue based on process priority, size or process type

• Each queue would have its own scheduling algorithm

• Each queue has a priority over lower-level queues

• Time slices can be allocated to queues

Algorithm 3 - Multilevel Feedback Queue


• Processes are allowed to move between queues

• Processes are separated by CPU burst time

• If a process utilizes too much CPU time it will be moved to a lower priority queue

You might also like