* Using SJF preemptive scheduling:
P2 will execute from time 0 to 5 ms.
P3 will execute from time 5 to 8 ms.
P1 will execute from time 8 to 18 ms.
P4 will execute from time 18 to 38 ms.
P5 will execute from time 38 to 40 ms.
Total waiting time = (10-5) + (8-5) + (18-0) + (38-5) + (40-10) = 5.6 + 3 + 18 + 33 + 30 = 90
Average waiting time = Total waiting time / Number of processes = 90/5 = 5.6 ms
* Using Priority preemptive scheduling
This document summarizes key concepts from Chapter 5 of the textbook "Operating System Concepts - 8th Edition" regarding CPU scheduling. It introduces CPU scheduling as the basis for multiprogrammed operating systems. Various scheduling algorithms are described such as first-come first-served, shortest job first, priority scheduling, and round robin. Criteria for evaluating scheduling algorithms include CPU utilization, throughput, turnaround time, waiting time, and response time. Ready queues can be partitioned into multiple levels with different scheduling policies to implement multilevel queue and feedback queue scheduling.
1. Process management is an integral part of operating systems for allocating resources, enabling information sharing, and protecting processes. The OS maintains data structures describing each process's state and resource ownership.
2. Processes go through discrete states and events can cause state changes. Scheduling selects processes to run from ready, device, and job queues using algorithms like round robin, shortest job first, and priority scheduling.
3. CPU scheduling aims to maximize utilization and throughput while minimizing waiting times using criteria like response time, turnaround time, and fairness between processes.
The document discusses CPU scheduling in operating systems. It describes how the CPU scheduler selects processes that are ready to execute and allocates the CPU to one of them. The goals of CPU scheduling are to maximize CPU utilization, minimize waiting times and turnaround times. Common CPU scheduling algorithms discussed are first come first serve (FCFS), shortest job first (SJF), priority scheduling, and round robin scheduling. Multilevel queue scheduling is also mentioned. Examples are provided to illustrate how each algorithm works.
Gives an overview about Process, PCB, Process States, Process Operations, Scheduling, Schedulers, Interprocess communication, shared memory and message passing systems
The document discusses the Shortest Job First (SJF) CPU scheduling algorithm. SJF is a preemptive scheduling policy that selects the waiting process with the shortest execution time/burst time to execute next. The algorithm involves sorting processes by arrival time and selecting the process with the shortest burst time. An example shows the Gantt chart and calculations for average turnaround time and waiting time using SJF. Advantages include shorter jobs being favored and minimum average waiting time, while disadvantages are potential starvation of longer jobs and inability for short-term CPU scheduling.
Process scheduling involves assigning system resources like CPU time to processes. There are three levels of scheduling - long, medium, and short term. The goals of scheduling are to minimize turnaround time, waiting time, and response time for users while maximizing throughput, CPU utilization, and fairness for the system. Common scheduling algorithms include first come first served, priority scheduling, shortest job first, round robin, and multilevel queue scheduling. Newer algorithms like fair share scheduling and lottery scheduling aim to prevent starvation.
CPU scheduling more complex when multiple CPUs are available
Homogeneous processors within a multiprocessor
Asymmetric multiprocessing – only one processor accesses the system data structures, alleviating the need for data sharing
Symmetric multiprocessing (SMP) – each processor is self-scheduling, all processes in common ready queue, or each has its own private queue of ready processes
Currently, most common
Processor affinity – process has affinity for processor on which it is currently running
soft affinity
hard affinity
Variations including processor sets
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
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
Round Robin is a preemptive scheduling algorithm where each process is allocated an equal time slot or time quantum to execute before being preempted. It is designed for time-sharing to ensure all processes are given a fair share of CPU time without starvation. The process is added to the back of the ready queue when its time slice expires. It provides low response time on average but increased context switching overhead compared to non-preemptive algorithms. The time quantum value impacts both processor utilization and response time.
Operating Systems - "Chapter 4: Multithreaded Programming"
This chapter discusses multithreaded programming and threads. It defines a thread as the basic unit of CPU utilization that allows multiple tasks to run concurrently within a process by sharing the process's resources. Different threading models like many-to-one, one-to-one, and many-to-many are described based on how user threads map to kernel threads. Common thread libraries for POSIX, Windows, and Java are also covered. The chapter examines issues in multithreaded programming and provides examples of how threads are implemented in Windows and Linux.
This document presents an overview of priority scheduling algorithms. It discusses basic concepts of scheduling, criteria like CPU utilization and turnaround time. It provides an example of priority scheduling with and without preemption. Advantages include ease of use and suitability for varying time requirements. A disadvantage is potential indefinite blocking of low priority processes.
This document discusses desktop systems and multiprocessor systems.
For desktop systems, it describes them as personal computers dedicated to single users, with keyboards, mice, displays and small printers. It notes they run operating systems like Windows, MacOS, UNIX and Linux.
For multiprocessor systems, it defines them as having multiple processors that share clocks, memory and buses. Symmetric multiprocessors have similar operating systems on each processor, while asymmetric ones have predefined master-slave roles. Multiprocessor systems provide advantages like reliability, throughput and cost-effectiveness, but require more memory, expense and complex operating systems.
Hello....
Dear views
Scheduling is most important Role in OS..... in this ppt i described very Creatively about Process Scheduling...... I hope you like it..... and easily understand it...... :-) :-)
Scheduling is a method used to allocate computing resources like processor time, bandwidth, and memory to processes, threads, and applications. It aims to balance system load, ensure equal distribution of resources, and prioritize processes according to set rules. There are different types of scheduling including long-term, medium-term, and short-term scheduling. Scheduling algorithms decide which process from the ready queue is allocated the CPU based on whether the policy is preemptive or non-preemptive. Common algorithms include first-come first-served, shortest job first, priority scheduling, and round-robin scheduling.
The document discusses various CPU scheduling algorithms used in operating systems. It describes the main objective of CPU scheduling as maximizing CPU utilization by allowing multiple processes to share the CPU. It then explains different scheduling criteria like throughput, turnaround time, waiting time and response time. Finally, it summarizes common scheduling algorithms like first come first served, shortest job first, priority scheduling and round robin scheduling.
The document discusses processes and process scheduling in operating systems. It defines a process as a program in execution that contains a program counter, stack, and data section. Processes can be in various states like new, ready, running, waiting, and terminated. A process control block contains information about each process like its state, program counter, memory allocation, and more. Scheduling aims to optimize CPU utilization, throughput, turnaround time, waiting time, and response time using algorithms like first come first serve, shortest job first, priority, and round robin scheduling.
The document discusses various scheduling algorithms used in operating systems including:
- First Come First Serve (FCFS) scheduling which services processes in the order of arrival but can lead to long waiting times.
- Shortest Job First (SJF) scheduling which prioritizes the shortest processes first to minimize waiting times. It can be preemptive or non-preemptive.
- Priority scheduling assigns priorities to processes and services the highest priority process first, which can potentially cause starvation of low priority processes.
- Round Robin scheduling allows equal CPU access to all processes by allowing each a small time quantum or slice before preempting to the next process.
The First Come First Serve (FCFS) CPU scheduling algorithm processes jobs in the order that they arrive in the ready queue. Newly arrived processes are added to the tail of the FIFO queue. The first process in the queue is scheduled first and removed from the queue. This is the simplest scheduling algorithm to implement but can result in long average wait times for processes as later arriving processes may have to wait for all earlier processes to complete.
It consists of CPU scheduling algorithms, examples, scheduling problems, realtime scheduling algorithms and issues. Multiprocessing and multicore scheduling.
This document summarizes key concepts from Chapter 5 of the textbook "Operating System Concepts - 8th Edition" regarding CPU scheduling. It introduces CPU scheduling as the basis for multiprogrammed operating systems. Various scheduling algorithms are described such as first-come first-served, shortest job first, priority scheduling, and round robin. Criteria for evaluating scheduling algorithms include CPU utilization, throughput, turnaround time, waiting time, and response time. Ready queues can be partitioned into multiple levels with different scheduling policies to implement multilevel queue and feedback queue scheduling.
1. Process management is an integral part of operating systems for allocating resources, enabling information sharing, and protecting processes. The OS maintains data structures describing each process's state and resource ownership.
2. Processes go through discrete states and events can cause state changes. Scheduling selects processes to run from ready, device, and job queues using algorithms like round robin, shortest job first, and priority scheduling.
3. CPU scheduling aims to maximize utilization and throughput while minimizing waiting times using criteria like response time, turnaround time, and fairness between processes.
The document discusses CPU scheduling in operating systems. It describes how the CPU scheduler selects processes that are ready to execute and allocates the CPU to one of them. The goals of CPU scheduling are to maximize CPU utilization, minimize waiting times and turnaround times. Common CPU scheduling algorithms discussed are first come first serve (FCFS), shortest job first (SJF), priority scheduling, and round robin scheduling. Multilevel queue scheduling is also mentioned. Examples are provided to illustrate how each algorithm works.
Gives an overview about Process, PCB, Process States, Process Operations, Scheduling, Schedulers, Interprocess communication, shared memory and message passing systems
The document discusses the Shortest Job First (SJF) CPU scheduling algorithm. SJF is a preemptive scheduling policy that selects the waiting process with the shortest execution time/burst time to execute next. The algorithm involves sorting processes by arrival time and selecting the process with the shortest burst time. An example shows the Gantt chart and calculations for average turnaround time and waiting time using SJF. Advantages include shorter jobs being favored and minimum average waiting time, while disadvantages are potential starvation of longer jobs and inability for short-term CPU scheduling.
Process scheduling involves assigning system resources like CPU time to processes. There are three levels of scheduling - long, medium, and short term. The goals of scheduling are to minimize turnaround time, waiting time, and response time for users while maximizing throughput, CPU utilization, and fairness for the system. Common scheduling algorithms include first come first served, priority scheduling, shortest job first, round robin, and multilevel queue scheduling. Newer algorithms like fair share scheduling and lottery scheduling aim to prevent starvation.
Operating system 31 multiple processor schedulingVaibhav Khanna
CPU scheduling more complex when multiple CPUs are available
Homogeneous processors within a multiprocessor
Asymmetric multiprocessing – only one processor accesses the system data structures, alleviating the need for data sharing
Symmetric multiprocessing (SMP) – each processor is self-scheduling, all processes in common ready queue, or each has its own private queue of ready processes
Currently, most common
Processor affinity – process has affinity for processor on which it is currently running
soft affinity
hard affinity
Variations including processor sets
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
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
Round Robin is a preemptive scheduling algorithm where each process is allocated an equal time slot or time quantum to execute before being preempted. It is designed for time-sharing to ensure all processes are given a fair share of CPU time without starvation. The process is added to the back of the ready queue when its time slice expires. It provides low response time on average but increased context switching overhead compared to non-preemptive algorithms. The time quantum value impacts both processor utilization and response time.
Operating Systems - "Chapter 4: Multithreaded Programming"Ra'Fat Al-Msie'deen
This chapter discusses multithreaded programming and threads. It defines a thread as the basic unit of CPU utilization that allows multiple tasks to run concurrently within a process by sharing the process's resources. Different threading models like many-to-one, one-to-one, and many-to-many are described based on how user threads map to kernel threads. Common thread libraries for POSIX, Windows, and Java are also covered. The chapter examines issues in multithreaded programming and provides examples of how threads are implemented in Windows and Linux.
This document presents an overview of priority scheduling algorithms. It discusses basic concepts of scheduling, criteria like CPU utilization and turnaround time. It provides an example of priority scheduling with and without preemption. Advantages include ease of use and suitability for varying time requirements. A disadvantage is potential indefinite blocking of low priority processes.
This document discusses desktop systems and multiprocessor systems.
For desktop systems, it describes them as personal computers dedicated to single users, with keyboards, mice, displays and small printers. It notes they run operating systems like Windows, MacOS, UNIX and Linux.
For multiprocessor systems, it defines them as having multiple processors that share clocks, memory and buses. Symmetric multiprocessors have similar operating systems on each processor, while asymmetric ones have predefined master-slave roles. Multiprocessor systems provide advantages like reliability, throughput and cost-effectiveness, but require more memory, expense and complex operating systems.
Hello....
Dear views
Scheduling is most important Role in OS..... in this ppt i described very Creatively about Process Scheduling...... I hope you like it..... and easily understand it...... :-) :-)
Scheduling is a method used to allocate computing resources like processor time, bandwidth, and memory to processes, threads, and applications. It aims to balance system load, ensure equal distribution of resources, and prioritize processes according to set rules. There are different types of scheduling including long-term, medium-term, and short-term scheduling. Scheduling algorithms decide which process from the ready queue is allocated the CPU based on whether the policy is preemptive or non-preemptive. Common algorithms include first-come first-served, shortest job first, priority scheduling, and round-robin scheduling.
The document discusses various CPU scheduling algorithms used in operating systems. It describes the main objective of CPU scheduling as maximizing CPU utilization by allowing multiple processes to share the CPU. It then explains different scheduling criteria like throughput, turnaround time, waiting time and response time. Finally, it summarizes common scheduling algorithms like first come first served, shortest job first, priority scheduling and round robin scheduling.
The document discusses processes and process scheduling in operating systems. It defines a process as a program in execution that contains a program counter, stack, and data section. Processes can be in various states like new, ready, running, waiting, and terminated. A process control block contains information about each process like its state, program counter, memory allocation, and more. Scheduling aims to optimize CPU utilization, throughput, turnaround time, waiting time, and response time using algorithms like first come first serve, shortest job first, priority, and round robin scheduling.
The document discusses different CPU scheduling algorithms:
1. First Come First Served scheduling allocates CPU to the longest waiting process first, which can result in longer processes waiting behind shorter ones (convoy effect).
2. Shortest Job First scheduling allocates CPU to the process with the shortest estimated run time, minimizing average wait time. Preemptive SJF allows interrupting the current process if a shorter one arrives.
3. Priority scheduling assigns priority levels and allocates CPU to the highest priority ready process. Preemption and aging policies address starvation of lower priority processes.
4. Round Robin scheduling allocates a time quantum (e.g. 10-100ms) to each ready process
The document discusses various CPU scheduling concepts and algorithms. It covers basic concepts like CPU-I/O burst cycles and scheduling criteria. It then describes common scheduling algorithms like first come first served (FCFS), shortest job first (SJF), priority scheduling, and round robin (RR). It also discusses more advanced topics like multi-level queue scheduling, multi-processor scheduling, and thread scheduling in Linux.
CPU scheduling decides which processes run when multiple are ready. It aims to make the system efficient, fast and fair. There are different scheduling algorithms like first come first serve (FCFS), shortest job first (SJF), priority scheduling, and round robin. Multi-level feedback queue scheduling uses multiple queues and allows processes to move between queues based on their CPU usage to prioritize shorter interactive processes.
This document discusses CPU scheduling in operating systems. It begins by introducing CPU scheduling and describing the goals of scheduling algorithms. It then explains common scheduling algorithms like first-come first-served (FCFS), shortest job first (SJF), priority scheduling, and round robin (RR). The document also covers multilevel queue scheduling, thread scheduling, multiple processor scheduling, and real-time CPU scheduling.
The document discusses process scheduling in operating systems. It covers basic concepts like scheduling criteria, algorithms like FCFS, SJF, priority and round robin scheduling. It explains key process states and scheduling techniques like preemptive and non-preemptive. Examples are provided to illustrate different scheduling algorithms and how they optimize criteria like waiting time, response time and CPU utilization.
This document discusses various CPU scheduling algorithms and concepts. It covers scheduling criteria like CPU utilization and turnaround time. Algorithms discussed include first-come first-served (FCFS), shortest job first (SJF), priority scheduling, and round robin (RR). It also covers multiple processor scheduling, real-time scheduling, and evaluating scheduling algorithms.
This document discusses various CPU scheduling algorithms and concepts. It covers scheduling criteria like CPU utilization and turnaround time. Algorithms discussed include first-come first-served (FCFS), shortest job first (SJF), priority scheduling, and round robin (RR). It also covers multiple processor scheduling, real-time scheduling, and evaluating scheduling algorithms.
The document discusses different CPU scheduling algorithms used in operating systems including first-come, first-served (FCFS), shortest job first (SJF), priority scheduling, and round robin (RR). It provides examples of how each algorithm works and compares their performance based on criteria like average waiting time, throughput, turnaround time, and response time. FCFS can lead to convoy effect with longer processes blocking shorter ones. SJF provides optimal waiting times but requires knowing future process lengths. Priority scheduling addresses starvation of low priority processes. RR gives each process a time slice or quantum before switching to ensure fairness.
This document discusses various CPU scheduling algorithms and concepts. It covers scheduling criteria like CPU utilization and turnaround time. Algorithms discussed include first-come first-served (FCFS), shortest job first (SJF), priority scheduling, and round robin (RR). It also covers multiple queue scheduling, real-time scheduling, and ways to evaluate scheduling algorithm performance like deterministic modeling and simulation.
CPU scheduling involves selecting which process to execute next from among processes in memory. There are several criteria for evaluating CPU scheduling algorithms, including CPU utilization, throughput, turnaround time, waiting time, and response time. Common algorithms include first-come, first-served (FCFS), shortest-job-first (SJF), priority scheduling, and round robin (RR). Multilevel queue and feedback queue scheduling involve partitioning processes into multiple queues that use different scheduling policies.
CPU scheduling is the process by which the CPU selects which process to execute next from among processes in memory that are ready to execute. The CPU scheduler selects processes from the ready queue to execute. The goal of CPU scheduling is to maximize CPU utilization and throughput while minimizing waiting time and response time. Common CPU scheduling algorithms include first come first serve (FCF) which services processes in the order they arrive, and shortest job first (SJF) which selects the process with the shortest estimated run time to execute next.
The document discusses various scheduling algorithms used in operating systems including:
- First Come First Serve (FCFS) scheduling which services processes in the order they arrive but can lead to long wait times.
- Shortest Job First (SJF) scheduling which prioritizes the shortest processes first to minimize wait times. This can be preemptive or non-preemptive.
- Priority scheduling which assigns priorities to processes and services the highest priority first, which can cause starvation of low priority processes.
- Round Robin scheduling which allows fair sharing of the CPU by allocating a time quantum or slice to each process in a cyclic manner.
The document discusses various scheduling algorithms used in operating systems including:
- First Come First Serve (FCFS) scheduling which services processes in the order of arrival but can lead to long waiting times.
- Shortest Job First (SJF) scheduling which prioritizes the shortest processes first to minimize waiting times. It can be preemptive or non-preemptive.
- Priority scheduling assigns priorities to processes and services the highest priority process first, which can potentially cause starvation of low priority processes.
- Round Robin scheduling allows equal CPU access to all processes by allowing each a small time quantum before being preempted. It has lower average waiting times than FCFS but higher than SJF.
Unit iios process scheduling and synchronizationdonny101
The document discusses process scheduling and synchronization in operating systems. It covers CPU scheduling algorithms like first-come first-served, shortest job first, priority scheduling, and round robin. It also discusses concepts like critical section problem, synchronization methods using semaphores and monitors, and solutions to deadlocks. Process synchronization ensures that processes access shared resources in a mutually exclusive way.
The document discusses operating system scheduling. It defines key scheduling criteria like CPU utilization, throughput, turnaround time, waiting time, and response time. It also outlines common scheduling algorithms like first-come first-served (FCFS), shortest-job-next (SJN), priority scheduling, shortest remaining time, and round robin. For each algorithm, it provides examples of how they work and how to calculate metrics like waiting time and turnaround time. It also distinguishes between time-sharing systems, which context switch between processes frequently for fast response, and parallel processing systems, which divide programs across multiple processors.
Response & Safe AI at Summer School of AI at IIITHIIIT Hyderabad
Talk covering Guardrails , Jailbreak, What is an alignment problem? RLHF, EU AI Act, Machine & Graph unlearning, Bias, Inconsistency, Probing, Interpretability, Bias
Development of Chatbot Using AI/ML Technologiesmaisnampibarel
The rapid advancements in artificial intelligence and natural language processing have significantly transformed human-computer interactions. This thesis presents the design, development, and evaluation of an intelligent chatbot capable of engaging in natural and meaningful conversations with users. The chatbot leverages state-of-the-art deep learning techniques, including transformer-based architectures, to understand and generate human-like responses.
Key contributions of this research include the implementation of a context- aware conversational model that can maintain coherent dialogue over extended interactions. The chatbot's performance is evaluated through both automated metrics and user studies, demonstrating its effectiveness in various applications such as customer service, mental health support, and educational assistance. Additionally, ethical considerations and potential biases in chatbot responses are examined to ensure the responsible deployment of this technology.
The findings of this thesis highlight the potential of intelligent chatbots to enhance user experience and provide valuable insights for future developments in conversational AI.
Understanding Cybersecurity Breaches: Causes, Consequences, and PreventionBert Blevins
Cybersecurity breaches are a growing threat in today’s interconnected digital landscape, affecting individuals, businesses, and governments alike. These breaches compromise sensitive information and erode trust in online services and systems. Understanding the causes, consequences, and prevention strategies of cybersecurity breaches is crucial to protect against these pervasive risks.
Cybersecurity breaches refer to unauthorized access, manipulation, or destruction of digital information or systems. They can occur through various means such as malware, phishing attacks, insider threats, and vulnerabilities in software or hardware. Once a breach happens, cybercriminals can exploit the compromised data for financial gain, espionage, or sabotage. Causes of breaches include software and hardware vulnerabilities, phishing attacks, insider threats, weak passwords, and a lack of security awareness.
The consequences of cybersecurity breaches are severe. Financial loss is a significant impact, as organizations face theft of funds, legal fees, and repair costs. Breaches also damage reputations, leading to a loss of trust among customers, partners, and stakeholders. Regulatory penalties are another consequence, with hefty fines imposed for non-compliance with data protection regulations. Intellectual property theft undermines innovation and competitiveness, while disruptions of critical services like healthcare and utilities impact public safety and well-being.
Social media management system project report.pdfKamal Acharya
The project "Social Media Platform in Object-Oriented Modeling" aims to design
and model a robust and scalable social media platform using object-oriented
modeling principles. In the age of digital communication, social media platforms
have become indispensable for connecting people, sharing content, and fostering
online communities. However, their complex nature requires meticulous planning
and organization.This project addresses the challenge of creating a feature-rich and
user-friendly social media platform by applying key object-oriented modeling
concepts. It entails the identification and definition of essential objects such as
"User," "Post," "Comment," and "Notification," each encapsulating specific
attributes and behaviors. Relationships between these objects, such as friendships,
content interactions, and notifications, are meticulously established.The project
emphasizes encapsulation to maintain data integrity, inheritance for shared behaviors
among objects, and polymorphism for flexible content handling. Use case diagrams
depict user interactions, while sequence diagrams showcase the flow of interactions
during critical scenarios. Class diagrams provide an overarching view of the system's
architecture, including classes, attributes, and methods .By undertaking this project,
we aim to create a modular, maintainable, and user-centric social media platform that
adheres to best practices in object-oriented modeling. Such a platform will offer users
a seamless and secure online social experience while facilitating future enhancements
and adaptability to changing user needs.
OCS Training Institute is pleased to co-operate with
a Global provider of Rig Inspection/Audits,
Commission-ing, Compliance & Acceptance as well as
& Engineering for Offshore Drilling Rigs, to deliver
Drilling Rig Inspec-tion Workshops (RIW) which
teaches the inspection & maintenance procedures
required to ensure equipment integrity. Candidates
learn to implement the relevant standards &
understand industry requirements so that they can
verify the condition of a rig’s equipment & improve
safety, thus reducing the number of accidents and
protecting the asset.
A vernier caliper is a precision instrument used to measure dimensions with high accuracy. It can measure internal and external dimensions, as well as depths.
Here is a detailed description of its parts and how to use it.
2. CPU scheduling
A process execution consist office cycle of CPU execution and input output
execution
Every process begins with CPU burst that may be followed by input output
bus, then another CPU burst and then input output burst and so on
eventually in the last will end up on CPU burst
CPU burst there are those processes which require most of time on CPU
Input output bus which require most of the time on input output devices
for peripherals
A good CPU scheduling idea should choose the mixture of both so that
both input and output devices and CPU can be utilized efficiently
3. Basic Concepts
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
For example
o cricket team
o printing document
o addition of two numbers
4. CPU scheduling terminology
Burst time /execution time /running time:- is the time causes required for
running on CPU
Waiting time:- time spent by a process in ready state waiting for CPU
Arrival time:- When a process enters ready state
Turnaround time:- total time spent by a process in the system and around time
equal to {exit time - arrival time} or {burst time + waiting time}
Response time:- Time between a process enters ready queue and get
scheduled on the CPU for the first time
Exit time:- when process completes execution and exit from system
6. CPU scheduling Algorithm
Two approaches
1. Non-Preemptive Scheduling:
2. Preemptive Scheduling:
Non-preemptive
Once resources(CPU Cycle) are allocated to a process, the process holds it till it completes its burst time or switches
to waiting state
Process can not be interrupted until it terminates itself or its time is up.
Rigid, not cost association
Preemptive
In this resources(CPU Cycle) are allocated to a process for a limited time
Process can be interrupted in between.
Flexible and cost associated
7. Scheduling Algorithm Optimization Criteria
Max CPU utilization
Max throughput
Min turnaround time
Min waiting time
Min response time
8. First Come First serve (FCFS)
It assign CPU to the process which arrives first
Easy to understand and can easily be implemented using queue data structure
Allows non-pre-emptive in nature
9. First- Come, First-Served (FCFS) Scheduling
Process Burst Time
P1 24
P2 3
P3 3
Suppose that the processes arrive in the order: P1 , P2 , P3
The Gantt Chart for the schedule is:
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
P P P1 2 3
0 24 3027
A Gantt chart is a horizontal bar chart
developed as a production control tool in
1917 by Henry L. Gantt,
an American engineer and social scientist
10. Solve this
Pid AT BT TAT WT
A 3 4
B 5 3
C 0 2
D 5 1
E 4 3
Create Gantt Chart
Calculate Waiting Time of each and
average waiting time
11. Convoy Effect
Pid AT BT WT AWT
P1 0 100 0
P2 1 1 99
Create Gantt Chart
Pid AT BT WT AWT
P1 1 100 1
P2 0 1 0
Create Gantt Chart
Smaller process have to wait for long time for bigger process to release CPU
12. Advantages
Easy to learn
Easy to understand
Easy to implement
We used for background process where execution is not urgent
13. Disadvantages
Suffer from Convoy effect
Normally long average waiting time
No consideration to burst time or arrival time/Priority
Should not be used for interactive system
14. Shortest job first (non-preemptive) shortest
remaining time first(SRTF) (preemptive)
Out of all available process CPU is assigned to the process having smallest burst time
requirement no priority, no seniority
If there is tie first Come First serve is used to break tie
Can we used both with non primitive and primitive approach
Primitive version STRF is also called as optimal as it currently minimum average waiting
time
15. Example of SJF
Process Arrivall Time Burst Time
P1 1 6
P2 2 8
P3 4 7
P4 0 3
SJF scheduling chart
Average waiting time = (3 + 16 + 9 + 0) / 4 = 7
P3
0 3 24
P4
P1
169
P2
16. SJF (non-preemptive)
Pid AT BT TAT WT
A 3 1
B 1 4
C 4 2
D 0 6
E 2 3
Create Gantt Chart
Calculate Waiting Time of Processes
17. Example of Shortest-remaining-time-first
Now we add the concepts of varying arrival times and preemption to
the analysis
Process Arrival Time Burst Time
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Preemptive SJF Gantt Chart
Average waiting time = [(10-1)+(1-1)+(17-2)+5-3)]/4 = 26/4 = 6.5
P4
0 1 26
P1
P2
10
P3
P1
5 17
18. SRTF(Pre-emptive)
Pid AT BT TAT WT
A 3 4
B 5 3
C 0 2
D 5 1
E 4 3
Create Gantt Chart
Calculate Waiting Time of Processes
19. Advantages and disadvantages of shortest job
first scheduling algorithm
Advantages
SRTF guarantees minimal average waiting
time
Standard for other algorithm in terms of
average waiting time
Better Average response time compare to
First Come First serve
Disadvantages
Algorithm cannot be implemented as there
is no way to know the burst time of a
process
Process with the longest CPU burst time
requirement will go into starvation
No idea of priority, process with large burst
time have work response time
20. Priority Algorithm
Here a priority is associated with each process
At any instance of time out of all available process, CPU is allocated to the process
which posses the highest Priority
Tie is broken with FCFS order
No importance to arrival time or burst time
Supports both non pre-emptive and pre-emptive version
21. Continue..
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority
Preemptive
Non-preemptive
SJF is priority scheduling where priority is the inverse of predicted
next CPU burst time
Problem Starvation – low priority processes may never execute
Solution Aging – as time progresses increase the priority of the
process
23. Non Pre-emptive
Pid AT BT Priority TAT WT
P1 0 4 2
P2 1 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
Create Gantt Chart
Calculate Waiting Time of Processes
24. Pre-emptive
Pid AT BT Priority TAT WT
P1 0 4 2
P2 1 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
Create Gantt Chart
Calculate Waiting Time of Processes
25. Advantages and disadvantages of priority
scheduling algorithm
Advantages
Provide a facility of priority specially for
system process
Allows to run important process first even
if it is a user process
Disadvantages
Here process with smaller priority may
starve for CPU
No idea of response time or waiting time
Note aging is a technique of gradually
increasing the priority of process that wait
in the system for long time
26. Round Robin (RR)
Each process gets a small unit of CPU time (time quantum q),
usually 10-100 milliseconds. After this time has elapsed, the
process is preempted and added to the end of the ready queue.
If there are n processes in the ready queue and the time quantum
is q, then each process gets 1/n of the CPU time in chunks of at
most q time units at once. No process waits more than (n-1)q
time units.
Timer interrupts every quantum to schedule next process
Performance
q large FIFO
q small q must be large with respect to context switch, otherwise
overhead is too high
27. Continue.
It is design for time sharing system where it is not necessary to complete one process
and then start another, but to be responsive and divide time of CPU among the
process in the ready state
Here ready q to be treated as circular queue
We will fix the time quantum up to which process can hold the CPU in one go within
which either a process terminates or process must release the CPU and re-enter in the
circular queue and wait for the next chance
Round Robin is called preemptive in nature
28. Example of RR with Time Quantum =
4
Process Burst Time
P1 24
P2 3
P3 3
The Gantt chart is:
Typically, higher average turnaround than SJF, but better response
q should be large compared to context switch time
q usually 10ms to 100ms, context switch < 10 usec
P P P1 1 1
0 18 3026144 7 10 22
P2
P3
P1
P1
P1
29. Pre-emptive
Pid AT BT TAT WT
A 0 5
B 1 3
C 2 1
D 3 2
E 4 3
TQ=2
Create Queue
Create Gantt Chart
Calculate Waiting Time of Processes
30. Advantages and disadvantages of Round Robin
scheduling algorithm
Advantages
Perform best in terms of average response
time
Works well in call to time sharing system,
client server architecture and interactive
system
Kind of shortest job first implementation
Disadvantages
Longer process may starve
Performance depends heavily on time
Quantum
No idea of reality
31. 1. The following is the set of processes whose arrival time, burst time and the priorities are given
below:
S.No. Process Arrival time (in ms) Bunt Time(in ms) Priority
1 P1 0 10 5
2 P2 0 5 2
3 P3 2 3 1
4 P4 5 20 4
5 P5 10 2 3
If Shortest job first ( vith pre-emption) scheduling policy and Priority scheduling policy(with pre-
emption) is used then, what will be the average waiting time in both the cases?
Ops:
A. 5.6 ms, 8 ms
B. None of the mentioned options
C. 6.8 ms, 7.6 ms
D. 0 5.6 ms, 7.6 ms
Question