Podcast
Questions and Answers
In the exponential averaging formula for predicting CPU burst length, what does the parameter α represent?
In the exponential averaging formula for predicting CPU burst length, what does the parameter α represent?
- The length of the previous CPU burst.
- The length of the most recent CPU burst.
- The weight given to the past history.
- The relative weight of recent and past history. (correct)
If α = 1 in the exponential averaging formula, then only the most recent CPU burst matters when predicting the next CPU burst length.
If α = 1 in the exponential averaging formula, then only the most recent CPU burst matters when predicting the next CPU burst length.
True (A)
What is another name for preemptive SJF scheduling?
What is another name for preemptive SJF scheduling?
shortest-remaining-time-first scheduling
When using exponential averaging, if $\alpha = 0$, then $\tau_{n+1}$ = ____.
When using exponential averaging, if $\alpha = 0$, then $\tau_{n+1}$ = ____.
Match the value of alpha (α) with its effect on the prediction of the next CPU burst using exponential averaging:
Match the value of alpha (α) with its effect on the prediction of the next CPU burst using exponential averaging:
What type of context switch occurs when a process blocks for I/O?
What type of context switch occurs when a process blocks for I/O?
A nonvoluntary context switch happens when a process completes its time slice.
A nonvoluntary context switch happens when a process completes its time slice.
What is the conceptual range for CPU utilization?
What is the conceptual range for CPU utilization?
The time it takes for a process from submission to completion is known as the ______ time.
The time it takes for a process from submission to completion is known as the ______ time.
Which of these is NOT directly affected by a CPU-scheduling algorithm?
Which of these is NOT directly affected by a CPU-scheduling algorithm?
Throughput is measured in the number of processes completed per second and so it is only applicable to short transactions.
Throughput is measured in the number of processes completed per second and so it is only applicable to short transactions.
What is the term for the amount of time a process spends waiting in the ready queue?
What is the term for the amount of time a process spends waiting in the ready queue?
Match the scheduling criteria with their definitions:
Match the scheduling criteria with their definitions:
What happens if a process's CPU burst is longer than one time quantum in Round Robin scheduling?
What happens if a process's CPU burst is longer than one time quantum in Round Robin scheduling?
Round Robin scheduling is a non-preemptive algorithm.
Round Robin scheduling is a non-preemptive algorithm.
In Round Robin scheduling, if there are 'n' processes in the ready queue and the time quantum is 'q', how much CPU time does each process get?
In Round Robin scheduling, if there are 'n' processes in the ready queue and the time quantum is 'q', how much CPU time does each process get?
A _______ switch occurs when a process is preempted in Round Robin scheduling.
A _______ switch occurs when a process is preempted in Round Robin scheduling.
Consider three processes P1, P2, and P3 with burst times 24, 3, and 3 milliseconds respectively. If the time quantum is 4 milliseconds, what is the waiting time of process P1?
Consider three processes P1, P2, and P3 with burst times 24, 3, and 3 milliseconds respectively. If the time quantum is 4 milliseconds, what is the waiting time of process P1?
Match the following terms with their description:
Match the following terms with their description:
In a Round Robin scheduling algorithm, if a process has a CPU burst equal to the time quantum, what happens when the time quantum expires?
In a Round Robin scheduling algorithm, if a process has a CPU burst equal to the time quantum, what happens when the time quantum expires?
In round robin scheduling, what happens after a running process’s time quantum has expired?
In round robin scheduling, what happens after a running process’s time quantum has expired?
What does the PTHREAD_SCOPE_SYSTEM
scheduling policy do on many-to-many systems?
What does the PTHREAD_SCOPE_SYSTEM
scheduling policy do on many-to-many systems?
The function pthread_attr_setscope()
is used to retrieve the current contention scope.
The function pthread_attr_setscope()
is used to retrieve the current contention scope.
What are the two possible values that can be passed to pthread_attr_setscope()
to set the contention scope?
What are the two possible values that can be passed to pthread_attr_setscope()
to set the contention scope?
The pthread_attr_getscope()
function receives a pointer to an ______ value that is set to the current value of the contention scope.
The pthread_attr_getscope()
function receives a pointer to an ______ value that is set to the current value of the contention scope.
Match the following functions with their primary actions:
Match the following functions with their primary actions:
In the provided code example, what contention scope is set for the threads?
In the provided code example, what contention scope is set for the threads?
The code example initializes a thread, sets the scope to PTHREAD_SCOPE_SYSTEM
, and then creates five threads, effectively setting all 5 threads to this specified scope.
The code example initializes a thread, sets the scope to PTHREAD_SCOPE_SYSTEM
, and then creates five threads, effectively setting all 5 threads to this specified scope.
What does the code in Figure 5.10 do after retrieving the existing scope?
What does the code in Figure 5.10 do after retrieving the existing scope?
What is a primary consideration when sharing resources within a physical core?
What is a primary consideration when sharing resources within a physical core?
A multithreaded, multicore processor requires only one level of scheduling.
A multithreaded, multicore processor requires only one level of scheduling.
What is the primary focus of the first level of scheduling in a multithreaded, multicore processor?
What is the primary focus of the first level of scheduling in a multithreaded, multicore processor?
At the second level of scheduling, a simple ______ algorithm can be used to schedule hardware threads to the processing core.
At the second level of scheduling, a simple ______ algorithm can be used to schedule hardware threads to the processing core.
How does the Intel Itanium prioritize hardware threads for execution?
How does the Intel Itanium prioritize hardware threads for execution?
The two different levels of scheduling in a multithreaded, multicore processor are mutually exclusive.
The two different levels of scheduling in a multithreaded, multicore processor are mutually exclusive.
According to Figure 5.15, what are the two levels of scheduling for a dual-threaded core? Answer with a comma-separated list.
According to Figure 5.15, what are the two levels of scheduling for a dual-threaded core? Answer with a comma-separated list.
Match the following scheduling levels with the appropriate action:
Match the following scheduling levels with the appropriate action:
In rate-monotonic scheduling, what determines the priority of a process?
In rate-monotonic scheduling, what determines the priority of a process?
Rate-monotonic scheduling always guarantees that all processes will meet their deadlines.
Rate-monotonic scheduling always guarantees that all processes will meet their deadlines.
What is the worst-case CPU utilization for rate-monotonic scheduling with an infinite number of processes?
What is the worst-case CPU utilization for rate-monotonic scheduling with an infinite number of processes?
With rate-monotonic scheduling, if a process has a shorter period, it is assigned a ______ priority.
With rate-monotonic scheduling, if a process has a shorter period, it is assigned a ______ priority.
If two processes have a combined CPU utilization of 75%, what can be said about their schedulability using rate-monotonic scheduling?
If two processes have a combined CPU utilization of 75%, what can be said about their schedulability using rate-monotonic scheduling?
Rate-monotonic scheduling is able to maximize CPU resources fully.
Rate-monotonic scheduling is able to maximize CPU resources fully.
Match the following terms with their description in the context of rate-monotonic scheduling:
Match the following terms with their description in the context of rate-monotonic scheduling:
What is the bounded CPU utilization for two processes using rate-monotonic scheduling?
What is the bounded CPU utilization for two processes using rate-monotonic scheduling?
Flashcards
Voluntary Context Switch
Voluntary Context Switch
A process relinquishes control of the CPU voluntarily due to resource unavailability, like waiting for I/O operation. This is a natural pause to acquire needed resources.
Nonvoluntary Context Switch
Nonvoluntary Context Switch
The CPU forcefully takes control from a process, often due to a time limit or another process taking priority. The process is interrupted.
CPU Utilization
CPU Utilization
The proportion of time the CPU is actively engaged in executing instructions. It measures CPU utilization efficiency.
Throughput
Throughput
Signup and view all the flashcards
Turnaround Time
Turnaround Time
Signup and view all the flashcards
Waiting Time
Waiting Time
Signup and view all the flashcards
Response Time
Response Time
Signup and view all the flashcards
Shortest Job First (SJF)
Shortest Job First (SJF)
Signup and view all the flashcards
α (Alpha) in Exponential Average
α (Alpha) in Exponential Average
Signup and view all the flashcards
Next CPU Burst Time (Ï„n+1)
Next CPU Burst Time (Ï„n+1)
Signup and view all the flashcards
Preemptive SJF
Preemptive SJF
Signup and view all the flashcards
Non-Preemptive SJF
Non-Preemptive SJF
Signup and view all the flashcards
Round Robin (RR) Scheduling
Round Robin (RR) Scheduling
Signup and view all the flashcards
Time Quantum
Time Quantum
Signup and view all the flashcards
Preemption
Preemption
Signup and view all the flashcards
Average Waiting Time
Average Waiting Time
Signup and view all the flashcards
CPU Burst Time
CPU Burst Time
Signup and view all the flashcards
Running Process
Running Process
Signup and view all the flashcards
PTHREAD_SCOPE_SYSTEM
PTHREAD_SCOPE_SYSTEM
Signup and view all the flashcards
Contention Scope Policy
Contention Scope Policy
Signup and view all the flashcards
pthread_attr_setscope(&attr, value)
pthread_attr_setscope(&attr, value)
Signup and view all the flashcards
PTHREAD_SCOPE_PROCESS
PTHREAD_SCOPE_PROCESS
Signup and view all the flashcards
pthread_attr_getscope(&attr, int* value)
pthread_attr_getscope(&attr, int* value)
Signup and view all the flashcards
Contention
Contention
Signup and view all the flashcards
LWP
LWP
Signup and view all the flashcards
pthread_attr_init()
pthread_attr_init()
Signup and view all the flashcards
Level 1 Scheduling
Level 1 Scheduling
Signup and view all the flashcards
Level 2 Scheduling
Level 2 Scheduling
Signup and view all the flashcards
Shared Core Resources
Shared Core Resources
Signup and view all the flashcards
Round-Robin Algorithm
Round-Robin Algorithm
Signup and view all the flashcards
Urgency-Based Scheduling
Urgency-Based Scheduling
Signup and view all the flashcards
Thread Switching Events
Thread Switching Events
Signup and view all the flashcards
OS Awareness of Shared Resources
OS Awareness of Shared Resources
Signup and view all the flashcards
Interdependent Scheduling
Interdependent Scheduling
Signup and view all the flashcards
Rate-Monotonic Scheduling
Rate-Monotonic Scheduling
Signup and view all the flashcards
Process Period
Process Period
Signup and view all the flashcards
Process Deadline
Process Deadline
Signup and view all the flashcards
CPU Burst
CPU Burst
Signup and view all the flashcards
Maximum CPU Utilization
Maximum CPU Utilization
Signup and view all the flashcards
Number of Processes (N)
Number of Processes (N)
Signup and view all the flashcards
N(21/N - 1)
N(21/N - 1)
Signup and view all the flashcards
Study Notes
CPU Scheduling
- CPU scheduling is fundamental to multiprogrammed operating systems, allowing the system to switch between processes and increase productivity.
- Modern operating systems schedule kernel-level threads instead of processes; the terms are often used interchangeably.
- A core is the basic computational unit of a CPU, and processes execute on CPU cores.
Chapter Objectives
- Describe various CPU scheduling algorithms.
- Assess CPU scheduling algorithms based on criteria such as CPU utilization, throughput, turnaround time, waiting time, and response time.
- Explain issues related to multiprocessor and multicore scheduling.
- Explain various real-time scheduling algorithms.
- Describe the scheduling algorithms of Windows, Linux, and Solaris.
- Demonstrate modeling/simulation to evaluate CPU scheduling algorithms.
- Design a program to implement different CPU scheduling algorithms.
Basic Concepts
- In a system with a single CPU core, only one process can run at a time, others wait until the CPU is free, and get rescheduled.
- Multiprogramming aims to keep the CPU busy by alternating processes.
- CPU burst is when the process is being executed by the CPU.
- I/O burst is when the process is waiting to perform I/O.
- Processes alternate between CPU bursts and I/O bursts.
CPU-I/O Burst Cycle
- Process execution alternates between CPU execution and I/O wait.
- CPU burst durations typically vary widely, with many short bursts and fewer long bursts.
CPU Scheduler
- The CPU scheduler selects a process from the ready queue to execute.
- The ready queue can be implemented as a FIFO queue, priority queue, or a tree, or a similar structure.
Scheduling Criteria
- CPU utilization: Keeping the CPU busy as much as possible (0-100%).
- Throughput: Number of processes completed per time unit.
- Turnaround time: Time from submission to completion for a particular process, including waiting in the ready queue, CPU execution, and I/O.
- Waiting time: Sum of periods spent waiting in the ready queue.
- Response time: Time from submission to first response for interactive systems.
Scheduling Algorithms
- First-Come, First-Served (FCFS): Processes are executed in the order they arrive. It can result in significant waiting times if longer processes arrive early.
- Shortest Job First (SJF): Processes with shortest next CPU burst are scheduled first. It minimizes average waiting time, but predicting the next CPU burst is challenging (Optimal algorithm if CPU burst values were known).
- Round Robin (RR): Each process gets a small time quantum (e.g., 10-100 milliseconds). If a process's burst is longer than the time quantum, it's preempted and moved to the tail of the ready queue.
- Priority Scheduling: Processes are assigned priorities with higher-priority processes being served first. If multiple processes have the same priority an algorithm like FCFS is used, can cause indefinite blocking/starvation for low-priority processes.
- Multilevel Queue Scheduling: Processes are sorted into different queues based on priority (or other criteria) with different scheduling algorithms applied to each queue.
- Multilevel Feedback Queue Scheduling: Processes can move between queues based on their behavior (e.g., high CPU burst).
Multiprocessor Scheduling
- Multiprocessor systems support multiple physical or multiple cores on a chip.
- Load balancing is crucial to utilize multiple processors efficiently. Load balancing strategies include pull and push.
- Processor affinity is the tendency of a thread to run on the same processor to take advantage of a warm cache.
Real-Time CPU Scheduling
- Soft real-time systems provide no guarantees about completing tasks by deadlines.
- Hard real-time systems require strict deadline adherence for critical operations.
- Event latency (the time between an event and its service) is crucial in real-time systems.
- Interrupt and dispatch latency impact real-time system performance.
Priority-Based Scheduling
- Priorities are associated with processes, and higher-priority processes are given preference in scheduling.
- Indefinite blocking/starvation can be a problem when low-priority processes wait indefinitely.
- Aging is a technique to gradually increase the priority of processes waiting for a long time, preventing starvation.
Thread Scheduling
- Scheduling in multi-threaded systems can involve user-level or kernel threads
- Some systems offer process contention scope (PCS) in which a thread only competes with other processes' threads
- System contention scope (SCS) means a thread competes against other threads of the entire system
- Pthread API can be used to set/get contention scope
Evaluating Scheduling Algorithms
-
Deterministic modeling: Evaluating algorithms under a specific workload, offering exact values for comparison.
-
Queueing models: Modeling systems with fluctuating workloads. Evaluating average waiting times, utilizing mathematical formulas and probability distributions
-
Simulations: Simulating a complete system to evaluate how algorithms perform under realistic scenarios
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.