1/53
Looks like no tags are added yet.
CPU-I/O Burst Cycle
A cyclic process of execution that consists of CPU bursts and I/O bursts
CPU burst
an execution where the CPU loads, adds, stores, and reads from the file/command. It always begins and ends a process
I/O burst
an execution where the system waits for the I/O block to complete of the requested data/command
CPU Scheduler (short-term scheduler)
Selects from process in memory that are ready to execute and allocating the CPU (giving processing time)
When can CPU scheduling take place during a process?
When it…
Switches from running to waiting state
Switches from running to ready state
Swtiches from waiting to ready state
Terminates
Nonpreemptive Scheduling
When CPU scheduling happens ONLY when the process:
Switches from running to waiting
terminates
Dispatcher
Gives control of the CPU to the process chosen by the CPU scheduler. Including
Switching context
Switiching to user mode
Jumping to the proper locaiton in the user program to restart that program
Dispatch latency
Time it takes the dispatcher to stop on process and start another
Context Switching
When the CPU pauses a currently running process/thread, saves its state, and loads the saved state of ANOTHER process/thread so that it can run
User mode
Restricted execution state where standard apps (like games, web browsers etc) run with limited privlieges. Has no access to hardware or core system memory.
Kernel Mode
Grants full hardware and memory access, and runs core OS components.
Dispatch vs. Context Switch
Dispatch is the broader process of handling CPU control, Context switch is one specific process
Scheduling Criteria
CPU utilization (Max)
Throughput (Max)
Turnaround time (min)
Waiting time (min)
Response time (min)
However improving one often worsens another
CPU utilization
The percentage of time the CPU is actively executing something
Throughput
The # of processes that complete their execution per time unit
Turnaround time
The amount of time to execute a particular process. (Turnaround = completion time - arrival time)
Waiting time
Amount of time a process has been waiting in the ready queue
Response time
amount of time it takes from when a request is submitted until the first response is made
“First-Come, First-Serve” (FCFS) Scheduling
AKA FIFO scheduling. Executes processes in the exact order they arrive to the ready queue. It is Nonpreemptive as the process keeps the CPU unitl it releases it by either, terminating or requesting I/O
Burst time (execution time)
Total time a process actually needs to run on the CPU for execution
Convoy effect
When a short process waits behind a long process
Shortest job first Scheduling (SJF)
A algorithim which chooses to execute the process with the smallest CPU burst time, NEXT. If the burst times are the same, FCFS is used to break the tie.
Why is SJF considered to be an optimal algorithm
Because it gives the minimum average waiting time for a given set of processes, (short processes go first decreasing overall wait time) but the difficulty is knowing the length of the next CPU request
Types of SJF scheduling
Non-Preemptive:
Once the process is allocated to the CPU it cannot be preempted until it completes its CPU burst
Preemptive:
If a new process arrives with CPU burst length that is LESS than the time of the currently executing process, preempt. (can suffer from starvation)
Shortest remaining time first (SRTF)
An algorithm that chooses the process with the smallest remaining burst time. If their is a process currently running that has a greater remaining time than another, it will be preempt and sent back into ready state.
Preemptive Scheduling
The OS can forcibly interrupt a running process to assign a new processto the CPU. The removed process is sent back into the ready state.
It helps improve average wait time
Starvation (indefinite blocking)
When a process is perprtually being denied the resources it needs to execute because other processes continuously claim them
Priority Scheduling
A priority number is associated with each process, the process with the highest priority (smallest integer) gets chosen to execute. if there is a tie FCFS is used.
Can suffer from starvation but can be solved with Aging
Aging
As time progresse, increase the priority of the process
Preemptive Priority Scheduling
High priority new arrivals preempt the low-priority
Non-Preemptive Priority Scheduling
Simply moves the job at the head of the ready queue
Round Robin (RR)
Each process is given a small unit of CPU time (time quantum q), after the time has run out the process is preempted and added to the end of the ready queue
If there are n processes in the ready queue and q then each process gets 1/n of the CPU time in chucks of AT MOST q time units at once.
Bound waiting time
No process waits more than (n-1)q time units
Round Robin performance
If q is too LARGE = FIFO
If q is too SMALL = contet switch overhead is too high
Multilevel Queue
CPU scheduling method that divides the ready queue into seperate queues based on process traits (ex. priority, type, memory size,) before permanately assigning each process to one queue
Types of Multilevel queues
Foreground: interactive, user level apps that need quick response times (RR)
background: batch, long-running jobs without user interaction (FCFS)
Fixed Priority scheduling
A scheduling method where each process gets a priority value before execution, and the scheduler always runs the highest-priority ready task.
Multilevel Feedback Queue
Uses multiple priority queues and moves processes between them based on their past behavior.
Asymmetric multiprocessing
Type of processing where there is one master server (processor) that does all the scheduling including I/O processing and other system activites while the other processors only execute user codes
Symmetric multiprocessing (SMP)
Each processor is self-scheduling where they are all provided their own queue and utilize a common ready queue. often deals with processor affinity and load balancing
Processor affinity
Binds a process to execute only on a specfic CPU core or set of cores
Soft affinity
When the scheduler attempts to keep a process on the same core but will move it to another core if the current one gets overloaded
Hard affinity
When a process is strictly locked to a specifc cores, forbidding the OS from moving it (this is where most processor affinity problems come from)
Processor sets
A logically grouped subsets of system’s processors or cores dedicated to running specific processes or threads
Symmetric Multithreading (SMT)
Allows a single physical CPU core to execute instructions from multiple independent threads at the same time by treating each hardware thread as s seperate virutal core (logical processor)

Load Balancing
Attempts to keep workload evenly distributed across multiple CPUs or processor cores in a SMP system
Push migration
A dedicated task periodically checks the workload on each CPU core and moves processes from heavily loaded processors to idle or less-busy ones
pull migration
Load-balancing techniques in SMP systems where an idle processor actively takes a waiting task from the ready queue of a busy processor