CPU Scheduling is a process of determining which process will own CPU for execution while another process is on hold. The main task of CPU scheduling is to make sure that whenever the CPU remains idle, the OS at least select one of the processes available in the ready queue for execution.
It consists of CPU scheduling algorithms, examples, scheduling problems, realtime scheduling algorithms and issues. Multiprocessing and multicore scheduling.
It consists of CPU scheduling algorithms, examples, scheduling problems, realtime scheduling algorithms and issues. Multiprocessing and multicore scheduling.
Uniprocessor SchedulingCsci 430, Spring 2018Texas A&corbing9ttj
Uniprocessor
Scheduling
Csci 430, Spring 2018
Texas A&M University – Commerce
Derek Harter
Introduction
to Operating
System
Concepts
Types of Processor
Scheduling
Objective: Be able to explain the
differences between long-, medium- and
short-term scheduling policies.
Processor Scheduling
Aim is to assign processes to be executed by
the processor in a way that meets system
objectives, such as response time, throughput,
and processor efficiency
Broken down into three separate functions:
– Long-term
– Medium-term
– Short-term
Table 9.1
Types of Scheduling
Scheduling and Process State
Transitions
Figure 9.2
Nesting of
Scheduling
Functions
(Referencing figure 3.9b)
Queuing
Diagram
Long-Term Scheduler
Determines which programs are admitted to the system for
processing
Controls the degree of multiprogramming
the more processes that are created, the smaller the
percentage of time that each process can be executed
may limit to provide satisfactory service to the current set
of processes
Medium-Term
Scheduling
Part of the swapping function
Swapping-in decisions are based on the need
to manage the degree of
multiprogramming
considers the memory requirements of the
swapped-out processes
Short-Term Scheduling
Known as the dispatcher
Executes most frequently
Makes the fine-grained decision of which process to
execute next
Invoked when an event occurs that may lead to the
blocking of the current process or that may provide an
opportunity to preempt a currently running process in favor
of another
Scheduling Algorithms
Objective: Be able to assess the
performance of different scheduling policies
(for the short term scheduler or dispatcher).
Short Term Scheduling
Criteria
Main objective is to allocate
processor time to optimize certain
aspects of system behavior
A set of criteria is needed to
evaluate the scheduling policy
– User vs. system oriented
criteria
Short-Term Scheduling
Criteria: Performance
- Performance related criteria are quantative (can be measured)
- Examples: response time and throughput
- Not performance related are qualitative or not readily measured
- Predictability
Table 9.2
Scheduling
Criteria
Priority
Queuing
Alternative Scheduling
Policies
Selection Function
Determines which process, among ready processes, is selected
next for execution
May be based on priority, resource requirements, or the execution
characteristics of the process
If based on execution characteristics then important quantities
are:
w = time spent in system so far, waiting
e = time spent in execution so far
s = total service time required by the process, including e;
generally, this quantity must be estimated or supplied by the
user
Decision Mode
Specifies the
instants in time
at which the
selection
function is
exercised
Two
categories:
Nonpreemptive
Preemptive
N ...
In an operating system that uses paging for memory management, a page replacement algorithm is needed to decide which page needs to be replaced when a new page comes in.
Memory management is the process of controlling and coordinating a computer's main memory. It ensures that blocks of memory space are properly managed and allocated so the operating system (OS), applications and other running processes have the memory they need to carry out their operations.
Uniprocessor SchedulingCsci 430, Spring 2018Texas A&corbing9ttj
Uniprocessor
Scheduling
Csci 430, Spring 2018
Texas A&M University – Commerce
Derek Harter
Introduction
to Operating
System
Concepts
Types of Processor
Scheduling
Objective: Be able to explain the
differences between long-, medium- and
short-term scheduling policies.
Processor Scheduling
Aim is to assign processes to be executed by
the processor in a way that meets system
objectives, such as response time, throughput,
and processor efficiency
Broken down into three separate functions:
– Long-term
– Medium-term
– Short-term
Table 9.1
Types of Scheduling
Scheduling and Process State
Transitions
Figure 9.2
Nesting of
Scheduling
Functions
(Referencing figure 3.9b)
Queuing
Diagram
Long-Term Scheduler
Determines which programs are admitted to the system for
processing
Controls the degree of multiprogramming
the more processes that are created, the smaller the
percentage of time that each process can be executed
may limit to provide satisfactory service to the current set
of processes
Medium-Term
Scheduling
Part of the swapping function
Swapping-in decisions are based on the need
to manage the degree of
multiprogramming
considers the memory requirements of the
swapped-out processes
Short-Term Scheduling
Known as the dispatcher
Executes most frequently
Makes the fine-grained decision of which process to
execute next
Invoked when an event occurs that may lead to the
blocking of the current process or that may provide an
opportunity to preempt a currently running process in favor
of another
Scheduling Algorithms
Objective: Be able to assess the
performance of different scheduling policies
(for the short term scheduler or dispatcher).
Short Term Scheduling
Criteria
Main objective is to allocate
processor time to optimize certain
aspects of system behavior
A set of criteria is needed to
evaluate the scheduling policy
– User vs. system oriented
criteria
Short-Term Scheduling
Criteria: Performance
- Performance related criteria are quantative (can be measured)
- Examples: response time and throughput
- Not performance related are qualitative or not readily measured
- Predictability
Table 9.2
Scheduling
Criteria
Priority
Queuing
Alternative Scheduling
Policies
Selection Function
Determines which process, among ready processes, is selected
next for execution
May be based on priority, resource requirements, or the execution
characteristics of the process
If based on execution characteristics then important quantities
are:
w = time spent in system so far, waiting
e = time spent in execution so far
s = total service time required by the process, including e;
generally, this quantity must be estimated or supplied by the
user
Decision Mode
Specifies the
instants in time
at which the
selection
function is
exercised
Two
categories:
Nonpreemptive
Preemptive
N ...
In an operating system that uses paging for memory management, a page replacement algorithm is needed to decide which page needs to be replaced when a new page comes in.
Memory management is the process of controlling and coordinating a computer's main memory. It ensures that blocks of memory space are properly managed and allocated so the operating system (OS), applications and other running processes have the memory they need to carry out their operations.
Computer Memory is used to store information for immediate use on a computer. It is used to store data and instructions. Any program should be present in the main memory with every required information while execution.
Memory management is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution. Memory management keeps track of each and every memory location, regardless of 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.
A deadlock in OS is a situation in which more than one process is blocked because it is holding a resource and also requires some resource that is acquired by some other process
A deadlock in OS is a situation in which more than one process is blocked because it is holding a resource and also requires some resource that is acquired by some other process.
A deadlock in OS is a situation in which more than one process is blocked because it is holding a resource and also requires some resource that is acquired by some other process
A deadlock in OS is a situation in which more than one process is blocked because it is holding a resource and also requires some resource that is acquired by some other process. The four necessary conditions for a deadlock situation to occur are mutual exclusion, hold and wait, no preemption and circular
deadlock
A deadlock in OS is a situation in which more than one process is blocked because it is holding a resource and also requires some resource that is acquired by some other process. The four necessary conditions for a deadlock situation to occur are mutual exclusion, hold and wait, no preemption and circular
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
2. 5: CPU-Scheduling 2
What Is In This Chapter?
• This chapter is about how to get a process attached to a processor.
• It centers around efficient algorithms that perform well.
• The design of a scheduler is concerned with making sure all users get
their fair share of the resources.
CPU Scheduling
3. 5: CPU-Scheduling 3
What Is In This Chapter?
• Basic Concepts
• Scheduling Criteria
• Scheduling Algorithms
• Multiple-Processor Scheduling
• Real-Time Scheduling
• Thread Scheduling
• Operating Systems Examples
• Java Thread Scheduling
• Algorithm Evaluation
CPU Scheduling
4. 5: CPU-Scheduling 4
CPU SCHEDULING Scheduling
Concepts
Multiprogramming A number of programs can be in
memory at the same time. Allows
overlap of CPU and I/O.
Jobs (batch) are programs that run
without user interaction.
User (time shared) are programs that
may have user interaction.
Process is the common name for both.
CPU - I/O burst cycle Characterizes process execution,
which alternates, between CPU and
I/O activity. CPU times are
generally much shorter than I/O
times.
Preemptive Scheduling An interrupt causes currently
running process to give up the CPU
and be replaced by another process.
5. 5: CPU-Scheduling 5
CPU SCHEDULING The Scheduler
Selects from among the processes in memory that are ready to execute, and
allocates the CPU to one of them
CPU scheduling decisions may take place when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
Scheduling under 1 and 4 is nonpreemptive
All other scheduling is preemptive
6. 5: CPU-Scheduling 6
CPU SCHEDULING The Dispatcher
Dispatcher module gives control of the CPU to the process selected by the short-
term scheduler; this involves:
switching context
switching to user mode
jumping to the proper location in the user program to restart that program
Dispatch latency – time it takes for the dispatcher to stop one process and start
another running
7. 5: CPU-Scheduling 7
Note usage of the words DEVICE, SYSTEM, REQUEST, JOB.
UTILIZATION The fraction of time a device is in use. ( ratio of in-use time / total
observation time )
THROUGHPUT The number of job completions in a period of time. (jobs / second )
SERVICE TIME The time required by a device to handle a request. (seconds)
QUEUEING TIME Time on a queue waiting for service from the device. (seconds)
RESIDENCE TIME The time spent by a request at a device.
RESIDENCE TIME = SERVICE TIME + QUEUEING TIME.
RESPONSE TIME Time used by a system to respond to a User Job. ( seconds )
THINK TIME The time spent by the user of an interactive system to figure out the next
request. (seconds)
The goal is to optimize both the average and the amount of variation. (but beware the ogre
predictability.)
CPU SCHEDULING
Criteria For
Performance
Evaluation
8. 5: CPU-Scheduling 8
Most Processes Don’t Use Up Their Scheduling Quantum!
CPU SCHEDULING
Scheduling
Behavior
9. 5: CPU-Scheduling 9
FIRST-COME, FIRST SERVED:
( FCFS) same as FIFO
Simple, fair, but poor performance. Average queueing time may be long.
What are the average queueing and residence times for this scenario?
How do average queueing and residence times depend on ordering of these
processes in the queue?
CPU SCHEDULING Scheduling
Algorithms
10. 5: CPU-Scheduling 10
EXAMPLE DATA:
Process Arrival Service
Time Time
1 0 8
2 1 4
3 2 9
4 3 5
0 8 12 21 26
P1 P2 P3 P4
FCFS
Average wait = ( (8-0) + (12-1) + (21-2) + (26-3) )/4 = 61/4 = 15.25
CPU SCHEDULING Scheduling
Algorithms
Residence Time
at the CPU
11. 5: CPU-Scheduling 11
SHORTEST JOB FIRST:
Optimal for minimizing queueing time, but impossible to implement.
Tries to predict the process to schedule based on previous history.
Predicting the time the process will use on its next schedule:
t( n+1 ) = w * t( n ) + ( 1 - w ) * T( n )
Here: t(n+1) is time of next burst.
t(n) is time of current burst.
T(n) is average of all previous bursts .
W is a weighting factor emphasizing current or previous bursts.
CPU SCHEDULING Scheduling
Algorithms
12. 5: CPU-Scheduling 12
PREEMPTIVE ALGORITHMS:
Yank the CPU away from the currently executing process when a higher
priority process is ready.
Can be applied to both Shortest Job First or to Priority scheduling.
Avoids "hogging" of the CPU
On time sharing machines, this type of scheme is required because the
CPU must be protected from a run-away low priority process.
Give short jobs a higher priority – perceived response time is thus better.
What are average queueing and residence times? Compare with FCFS.
CPU SCHEDULING Scheduling
Algorithms
13. 5: CPU-Scheduling 13
EXAMPLE DATA:
Process Arrival Service
Time Time
1 0 8
2 1 4
3 2 9
4 3 5
0 5 10 17 26
P2 P4 P1 P3
Preemptive Shortest Job First
Average wait = ( (5-1) + (10-3) + (17-0) + (26-2) )/4 = 52/4 = 13.0
P1
1
CPU SCHEDULING Scheduling
Algorithms
14. 5: CPU-Scheduling 14
PRIORITY BASED SCHEDULING:
Assign each process a priority. Schedule highest priority first. All processes within
same priority are FCFS.
Priority may be determined by user or by some default mechanism. The system
may determine the priority based on memory requirements, time limits, or other
resource usage.
Starvation occurs if a low priority process never runs. Solution: build aging into a
variable priority.
Delicate balance between giving favorable response for interactive jobs, but not
starving batch jobs.
CPU SCHEDULING Scheduling
Algorithms
15. 5: CPU-Scheduling 15
ROUND ROBIN:
Use a timer to cause an interrupt after a predetermined time. Preempts if task
exceeds it’s quantum.
Train of events
Dispatch
Time slice occurs OR process suspends on event
Put process on some queue and dispatch next
Use numbers in last example to find queueing and residence times. (Use
quantum = 4 sec.)
Definitions:
– Context Switch Changing the processor from running one task
(or process) to another. Implies changing memory.
– Processor Sharing Use of a small quantum such that each process
runs frequently at speed 1/n.
– Reschedule latency How long it takes from when a process requests
to run, until it finally gets control of the CPU.
CPU SCHEDULING Scheduling
Algorithms
16. 5: CPU-Scheduling 16
ROUND ROBIN:
Choosing a time quantum
– Too short - inordinate fraction of the time is spent in context switches.
– Too long - reschedule latency is too great. If many processes want
the CPU, then it's a long time before a particular process can get the
CPU. This then acts like FCFS.
– Adjust so most processes won't use their slice. As processors have
become faster, this is less of an issue.
CPU SCHEDULING Scheduling
Algorithms
17. 5: CPU-Scheduling 17
EXAMPLE DATA:
Process Arrival Service
Time Time
1 0 8
2 1 4
3 2 9
4 3 5
0 8 12 16 26
P2 P3 P4 P1
Round Robin, quantum = 4, no priority-based preemption
Average wait = ( (20-0) + (8-1) + (26-2) + (25-3) )/4 = 74/4 = 18.5
P1
4
P3 P4
20 24 25
P3
CPU SCHEDULING Scheduling
Algorithms
Note:
Example violates rules for
quantum size since most
processes don’t finish in one
quantum.
18. 5: CPU-Scheduling 18
MULTI-LEVEL QUEUES:
Each queue has its scheduling algorithm.
Then some other algorithm (perhaps priority based) arbitrates between queues.
Can use feedback to move between queues
Method is complex but flexible.
For example, could separate system processes, interactive, batch, favored, unfavored
processes
CPU SCHEDULING Scheduling
Algorithms
20. 5: CPU-Scheduling 20
MULTIPLE PROCESSOR SCHEDULING:
Different rules for homogeneous or heterogeneous processors.
Load sharing in the distribution of work, such that all processors have an
equal amount to do.
Each processor can schedule from a common ready queue ( equal
machines ) OR can use a master slave arrangement.
Real Time Scheduling:
• Hard real-time systems – required to complete a critical task within a
guaranteed amount of time.
• Soft real-time computing – requires that critical processes receive priority
over less fortunate ones.
CPU SCHEDULING Scheduling
Algorithms
21. 5: CPU-Scheduling 21
Two algorithms: time-sharing and real-time
• Time-sharing
– Prioritized credit-based – process with most credits is scheduled next
– Credit subtracted when timer interrupt occurs
– When credit = 0, another process chosen
– When all processes have credit = 0, recrediting occurs
• Based on factors including priority and history
• Real-time
– Soft real-time
– Posix.1b compliant – two classes
• FCFS and RR
• Highest priority process runs first
CPU SCHEDULING Linux Scheduling
22. 5: CPU-Scheduling 22
How do we decide which algorithm is best for a particular environment?
• Deterministic modeling – takes a particular predetermined workload and defines
the performance of each algorithm for that workload.
• Queueing models.
CPU SCHEDULING Algorithm Evaluation
23. 5: CPU-Scheduling 23
We’ve looked at a number of different scheduling algorithms.
Which one works the best is application dependent.
General purpose OS will use priority based, round robin, preemptive
Real Time OS will use priority, no preemption.
CPU SCHEDULING
WRAPUP