CPU Scheduling: Dispatcher, CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on hold(in waiting state) due to unavailability of any resource like I/O etc., thereby making full use of CPU. The aim of CPU scheduling is to make the system efficient, fast and fair.
The dispatcher is the module that gives control of the CPU to the process selected by the
short-term scheduler.
It consists of CPU scheduling algorithms, examples, scheduling problems, realtime scheduling algorithms and issues. Multiprocessing and multicore scheduling.
In non-preemptive scheduling once a process has been allocated the CPU it runs uninterrupted until it finishes execution.
On the other hand, in preemptive schedule algorithms, the running process may be interrupted by a higher priority process in between its execution.
Whenever a process gets into ready state or the currently running finishes execution, the priority of the ready state process is checked against that of the running process.
If the priority of the ready process is more it is allowed to be allocated to the CPU.
Therefore, in these schemes, the CPU is allocated to the process with the highest priority all the time.
This gives rise to frequent context switching, which can become very costly in terms of CPU time wasted in switching. In the following sections we will explore some of such scheduling algorithms
This Presention contains Cpu scheduling algorithms,Scheduling Criteria,process sychroization,mutilevel feed back que,critical section problem anad semaphores,Synchoroniztion hardware
It consists of CPU scheduling algorithms, examples, scheduling problems, realtime scheduling algorithms and issues. Multiprocessing and multicore scheduling.
In non-preemptive scheduling once a process has been allocated the CPU it runs uninterrupted until it finishes execution.
On the other hand, in preemptive schedule algorithms, the running process may be interrupted by a higher priority process in between its execution.
Whenever a process gets into ready state or the currently running finishes execution, the priority of the ready state process is checked against that of the running process.
If the priority of the ready process is more it is allowed to be allocated to the CPU.
Therefore, in these schemes, the CPU is allocated to the process with the highest priority all the time.
This gives rise to frequent context switching, which can become very costly in terms of CPU time wasted in switching. In the following sections we will explore some of such scheduling algorithms
This Presention contains Cpu scheduling algorithms,Scheduling Criteria,process sychroization,mutilevel feed back que,critical section problem anad semaphores,Synchoroniztion hardware
Operating System
Topic Memory Management
for Btech/Bsc (C.S)/BCA...
Memory management is the functionality of an operating system which handles or manages primary memory. Memory management keeps track of each and every memory location either it is allocated to some process or it is free. It checks how much memory is to be allocated to processes. It decides which process will get memory at what time. It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status.
Maximum CPU utilization obtained with multiprogramming
CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait
CPU burst followed by I/O burst
CPU burst distribution is of main concern
Task Context.
Context Switching between tasks.
Shared Data Problem.
Non Reentrant Function.
Reentrant Function.
Gray area of reentrancy.
How to protect Shared Data?
Operating System
Topic Memory Management
for Btech/Bsc (C.S)/BCA...
Memory management is the functionality of an operating system which handles or manages primary memory. Memory management keeps track of each and every memory location either it is allocated to some process or it is free. It checks how much memory is to be allocated to processes. It decides which process will get memory at what time. It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status.
Maximum CPU utilization obtained with multiprogramming
CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait
CPU burst followed by I/O burst
CPU burst distribution is of main concern
Task Context.
Context Switching between tasks.
Shared Data Problem.
Non Reentrant Function.
Reentrant Function.
Gray area of reentrancy.
How to protect Shared Data?
operating systems , ch-05, (CPU Scheduling), 3rd level, College of Computers, Seiyun University. انظمة التشغيل لطلاب المستوى الثالث بكلية الحاسبات بجامعة سيئون المحاضرة 05
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
2. CONTENTS
Introduction
CPU Scheduling: Dispatcher
Types of CPU Scheduling
Non – Preemptive Scheduling
Preemptive Scheduling
CPU Scheduling: Scheduling Criteria
Scheduling Algorithms
First Come First Serve(FCFS) Scheduling
Shortest-Job-First(SJF) Scheduling
Shortest Remaining Time First (SRTF) Scheduling
Priority Non - Preemptive Scheduling
Priority Preemptive Scheduling
Round Robin(RR) Scheduling
2
3. Introduction
CPU scheduling is a process which allows one process to use the CPU while the execution
of another process is on hold(in waiting state) due to unavailability of any resource like
I/O etc., thereby making full use of CPU. The aim of CPU scheduling is to make the
system efficient, fast and fair.
Whenever the CPU becomes idle, the operating system must select one of the processes in
the ready queue to be executed. The selection process is carried out by the short-term
scheduler (or CPU scheduler). The scheduler selects from among the processes in
memory that are ready to execute, and allocates the CPU to one of them.
3
4. CPU Scheduling: Dispatcher
The dispatcher is the module that gives control of the CPU to the process selected by the
short-term scheduler. This function involves:
Switching context
Switching to user mode
Jumping to the proper location in the user program to restart that program from
where it left last time.
The dispatcher should be as fast as possible, given that it is invoked during every process
switch. The time taken by the dispatcher to stop one process and start another process is
known as the Dispatch Latency.
4
5. Types of CPU Scheduling
CPU scheduling decisions may take place under the following four circumstances:
When a process switches from the running state to the waiting state (for I/O request or
invocation of wait for the termination of one of the child processes).
When a process switches from the running state to the ready state (for example, when
an interrupt occurs).
When a process switches from the waiting state to the ready state (for example,
completion of I/O).
When a process terminates.
In circumstances 1 and 4, there is no choice in terms of scheduling. A new process(if one
exists in the ready queue) must be selected for execution. There is a choice, however in
circumstances 2 and 3.
When Scheduling takes place only under circumstances 1 and 4, we say the scheduling
scheme is Non-preemptive; otherwise the scheduling scheme is Preemptive.
5
6. Types of CPU Scheduling
Non-Preemptive Scheduling:
In this type of scheduling, once the CPU has been allocated to a process, the process
keeps the CPU until it releases the CPU either by terminating or by switching to the
waiting state.
It is the only method that can be used on certain hardware platforms, because It does
not require the special hardware(for example: a timer) needed for preemptive
scheduling.
Preemptive Scheduling:
In this type of Scheduling, the tasks are usually assigned with priorities. At times it is
necessary to run a certain task that has a higher priority before another task although
it is running.
Therefore, the running task is interrupted for some time and resumed later when the
priority task has finished its execution.
6
7. CPU Scheduling: Scheduling Criteria
There are many different criteria's to check when considering the "best" scheduling
algorithm, they are:
CPU Utilization: To make out the best use of CPU and not to waste any CPU cycle, CPU
would be working most of the time(Ideally 100% of the time). Considering a real
system, CPU usage should range from 40% (lightly loaded) to 90% (heavily loaded.)
Throughput: It is the total number of processes completed per unit time or rather say
total amount of work done in a unit of time. This may range from 10/second to
1/hour depending on the specific processes.
Turnaround Time: It is the amount of time taken to execute a particular process, i.e.
The interval from time of submission of the process to the time of completion of the
process(Wall clock time).
Waiting Time: It is the total time spent by the process in the ready state waiting to get
control on the CPU.
7
8. CPU Scheduling: Scheduling Criteria
Load Average: It is the average number of processes residing in the ready queue
waiting for their turn to get into the CPU.
Response Time: Amount of time it takes from when a request was submitted until the
first response is produced. Remember, it is the time till the first response and not the
completion of process execution(final response).
In general CPU utilization and Throughput are maximized and other factors are
reduced for proper optimization.
8
9. Scheduling Algorithms
To decide which process to execute first and which process to execute last to achieve
maximum CPU utilization, we have various scheduling algorithms as follows :
First Come First Serve(FCFS) Scheduling
Shortest Job First(SJF) Scheduling
Priority Scheduling
Round Robin(RR) Scheduling
9
10. First Come First Serve(FCFS)
Scheduling
In the "First come first serve" scheduling algorithm, the process which arrives first, gets
executed first, or we can say that the process which requests the CPU first, gets the CPU
allocated first.
It is a Non-preemptive Scheduling algorithm.
Easy to understand and implement.
Its implementation is based on FIFO queue.
Poor in performance as average wait time is high.
This is used in Batch Systems.
10
11. First Come First Serve(FCFS)
Scheduling
Example 1: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given jobs:
11
Jobs Arrival Time (A.T.) Burst Time (B.T.)
J1 1 5
J2 0 3
J3 2 2
J4 3 4
J5 2 8
13. First Come First Serve(FCFS)
Scheduling
Example 2: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
13
Process Arrival Time (A.T.) Burst Time (B.T.)
P1 1 5
P2 0 6
P3 1 2
P4 0 4
Avg. T.A.T. = 11.5 ms
Avg. W.T. = 7.2 ms
14. Shortest Job First(SJF) Scheduling
Shortest Job First scheduling works on the process with the shortest burst time or duration
first.
This is the best approach to minimize waiting time.
Easy to implement in Batch systems where required CPU time is known in advance.
Impossible to implement in interactive systems where required CPU time is not known.
Processer should know in advance how much time process will take.
It is of two types:
Non Pre-emptive (SJF)
Pre-emptive (SRTF)
14
15. Shortest Job First (SJF)
Non - Preemptive
In this type of scheduling CPU allocated to the process(min burst time) cannot be
preempted until completes its CPU burst.
Example 1: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given jobs:
15
Jobs Arrival Time (A.T.) Burst Time (B.T.)
J1 0 4
J2 1 1
J3 2 2
J4 3 1
17. Shortest Job First (SJF)
Non - Preemptive
Example 2: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
17
Jobs Arrival Time (A.T.) Burst Time (B.T.)
P1 3 5
P2 0 2
P3 4 2
P4 5 3
19. Shortest Job First (SJF)
Non - Preemptive
Example 3: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
19
Process Arrival Time (A.T.) Burst Time (B.T.)
P1 1.5 5
P2 0 1
P3 2 2
P4 3 4
Avg. T.A.T. = 4.875 ms
Avg. W.T. = 1.875 ms
20. Shortest Remaining Time First
(SRTF) Preemptive
In Preemptive Shortest Job First Scheduling, jobs are put into ready queue as they arrive,
but as a process with short burst time arrives, the existing process is preempted or removed
from execution, and the shorter job is executed first.
Example 1: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given jobs:
20
Jobs Arrival Time (A.T.) Burst Time (B.T.)
J1 0 4
J2 1 1
J3 2 2
J4 3 1
22. Shortest Remaining Time First
(SRTF) Preemptive
Example 2: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
22
Process Arrival Time (A.T.) Burst Time (B.T.)
P1 1.5 5
P2 0 1
P3 2 2
P4 3 4
24. Shortest Remaining Time First
(SRTF) Preemptive
Example 3: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
24
Jobs Arrival Time (A.T.) Burst Time (B.T.)
P1 3 5
P2 0 2
P3 4 2
P4 5 3
Avg. T.A.T. = 4.5 ms
Avg. W.T. = 1.5 ms
25. Priority Scheduling
Priority scheduling is one of the most common scheduling algorithms in batch systems.
Each process is assigned a priority. Process with highest priority is to be executed first and
so on.
Processes with same priority are executed on first come first serve basis.
Priority can be decided based on memory requirements, time requirements or any other
resource requirement.
It is of two types:
Non – Preemptive Scheduling
Preemptive Scheduling
25
26. Non –Preemptive Priority
Scheduling
In case of non – preemptive priority scheduling algorithm if a new process arrives with a
higher priority than the current running process, the incoming process is put at the head
of the ready queue, which means after the execution of the current process it will be
processed.
Example 1: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given jobs:
26
Jobs Arrival Time (A.T.) Burst Time (B.T.) Priority
J1 0 10 3
J2 4 5 0 (High)
J3 3 2 1
J4 5 16 2
J5 2 8 4 (Low)
28. Non –Preemptive Priority
Scheduling
Example 2: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
28
Jobs Arrival Time (A.T.) Burst Time (B.T.) Priority
P1 1 5 1 (High)
P2 0 6 2
P3 1 2 1
P4 0 4 3 (Low)
P5 2 3 2
30. Non –Preemptive Priority
Scheduling
Example 3: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
30
Jobs Arrival Time (A.T.) Burst Time (B.T.) Priority
P1 0 4 3
P2 2 3 1(Low)
P3 1 7 4 (High)
P4 3 15 2
Avg. T.A.T. = 16 ms
Avg. W.T. = 8.75 ms
31. Preemptive Priority Scheduling
If the new process arrived at the ready queue has a higher priority than the currently
running process, the CPU is preempted, which means the processing of the current process
is stopped and the incoming new process with higher priority gets the CPU for its
execution.
Example 1: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given jobs:
31
Jobs Arrival Time (A.T.) Burst Time (B.T.) Priority
J1 0 10 3
J2 4 5 0 (High)
J3 3 2 1
J4 5 16 2
J5 2 8 4 (Low)
33. Preemptive Priority Scheduling
Example 2: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
33
Jobs Arrival Time (A.T.) Burst Time (B.T.) Priority
P1 1 5 1 (High)
P2 0 6 2
P3 1 2 1
P4 0 4 3 (Low)
P5 2 3 2
35. Preemptive Priority Scheduling
Example 3: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process:
35
Jobs Arrival Time (A.T.) Burst Time (B.T.) Priority
P1 0 4 3
P2 2 3 1(Low)
P3 1 7 4 (High)
P4 3 15 2
Avg. T.A.T. = 17 ms
Avg. W.T. = 9.75 ms
36. Round Robin Scheduling
Round Robin is the preemptive process scheduling algorithm.
Each process is provided a fix time to execute called quantum.
Once a process is executed for given time period. Process is preempted and other process
executes for given time period.
Context switching is used to save states of preempted processes.
36
37. Round Robin Scheduling
Example 1: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process with Time Slice (Quantum) = 3ms.
37
Jobs Arrival Time (A.T.) Burst Time (B.T.)
P1 1 5
P2 0 7
P3 3 3
P4 2 10
39. Round Robin Scheduling
Example 2: Find out Average Turn – around time (T.A.T.) and Average Wait time (W.T.) for
the given process with Time Slice (Quantum) = 2ms.
39
Jobs Arrival Time (A.T.) Burst Time (B.T.)
P1 1 5
P2 0 3
P3 2 2
P4 3 4
P5 13 2
41. Round Robin Scheduling
Example 2: Five jobs arrive at 0 arrival time the order is given below. Find out Average
Turn – around time (T.A.T.) and Average Wait time (W.T.) for the given process with
Time Slice (Quantum) = 10ms.
41
Jobs Burst Time (B.T.)
J1 10
J2 29
J3 3
J4 7
J5 12
Avg. T.A.T. = 35.2 ms
Avg. W.T. = 23 ms