CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx

153 views 19 slides Apr 16, 2024
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

CPU Schedule Criteria


Slide Content

CHAPTER 7 CPU Scheduling: Basic Concepts, Scheduling Criteria, Scheduling Algorithms, Algorithm Evaluation

CPU SCHEDULING CRITERIA Definition : CPU scheduling is a crucial part of operating systems that determines the order and priority of processes to run on a CPU at any given moment. Purpose : It allows multiple processes to run concurrently on the same processor, optimizing system performance. Functionality : The CPU scheduler allocates CPU time to processes based on parameters like CPU usage, throughput, turnaround, waiting time, and response time. Importance : Ensures correct and timely execution of processes, contributing to overall system efficiency. Algorithms : Different CPU scheduling algorithms exist, each with distinct properties. The choice of algorithm depends on factors such as system requirements and priorities. Criteria for Comparison : Various criteria, including CPU usage, throughput, turnaround time, waiting time, and response time, are used to compare and evaluate the effectiveness of CPU scheduling algorithms.

CPU Scheduling in Operating Systems Objective: CPU scheduling aims to complete work on time by efficiently utilizing the CPU, allowing one process to use it while others are in standby due to resource unavailability. Resource Utilization: CPU scheduling ensures optimal use of the CPU by allowing processes to run when others are delayed, such as waiting for I/O resources. System Improvement: The purpose is to enhance system efficiency, speed, and fairness, ensuring that processes are executed in a timely and equitable manner. Idle CPU Handling: When the CPU is idle, the operating system's temporary scheduler selects a process from the ready queue, which contains processes prepared for execution. Launching Processes: The selected process is assigned the CPU for execution, ensuring a continuous flow of tasks and preventing unnecessary CPU downtime. Temporary Scheduler: The temporary scheduler plays a crucial role in selecting processes for execution, managing the flow of tasks when the CPU becomes available.

States of a Process in Operating Systems

States of a Process in Operating Systems New (Create): Process is about to be created but not yet created. Program in secondary memory picked up by OS to create the process. Ready: Follows the "New" state. Process is loaded into main memory. Ready to run and waiting for CPU time. Maintained in a queue called the ready queue. Run: Process chosen from ready queue for execution. Instructions within the process are executed by a CPU core. Blocked or Wait: Occurs when process requests I/O, user input, or access to a critical region. Process enters a waiting state, not requiring CPU. Resumes to the ready state once I/O or critical region access is complete.

States of a Process in Operating Systems Terminated or Completed: Process is killed, and PCB (Process Control Block) is deleted. Resources allocated to the process are released or deallocated. Suspend Ready: Process initially in ready state but swapped out of main memory. Placed onto external storage by the scheduler. Transitions back to ready state when brought back to main memory. Suspend Wait or Suspend Blocked: Similar to Suspend Ready but involves processes performing I/O operations. Lack of main memory causes them to move to secondary memory. Transitions back to Suspend Ready after completing the task. CPU and I/O Bound Processes: CPU Bound Process : Intensive in CPU operations. I/O Bound Process: Intensive in I/O operations.

How does a process move between different states in an operating system? A process can move between different states in an operating system based on its execution status and resource availability. New to Ready: Process is created and in the new state. Moves to the ready state when the operating system allocates necessary resources. Ready to Running: CPU becomes available. Operating system selects a process from the ready queue based on scheduling algorithms. Process moves to the running state for execution. Running to Blocked: Process needs to wait for an event (e.g., I/O operation or system call). Moves to the blocked state until the required event occurs.

How does a process move between different states in an operating system? A process can move between different states in an operating system based on its execution status and resource availability. Running to Ready: Running process is preempted by the operating system. Moves to the ready state, often due to a higher-priority process becoming ready. Blocked to Ready: Event a blocked process was waiting for occurs. Process moves to the ready state, ready for execution. Running to Terminated: Process completes execution or is terminated by the operating system. Moves to the terminated state.

Type of Scheduler in Operating Systems

Types of Schedulers – Short, Middle & Long Term Long-term Scheduler (Job Scheduler): Objective: Determines how many processes should stay in the ready state, deciding the degree of multiprogramming. Frequency: Runs infrequently, as its decisions last for a long time. Impact: Influences overall system performance by controlling the number of processes in the ready state.

Types of Schedulers - Short, Middle & Long Term Short-term Scheduler (CPU Scheduler): Objective: Decides which process to execute next and initiates context switching. Dispatcher: Utilizes a dispatcher (software) to move processes between ready and running states. Frequency: Runs frequently, managing the immediate execution of processes. Alias: Also known as the CPU scheduler.

Types of Schedulers - Short, Middle & Long Term Middle-term Scheduler: Objective: Makes decisions regarding process suspension, especially for swapping between main memory and secondary storage. Swapping: Involves moving processes to and from main memory to optimize resource usage. Frequency: Runs when needed, typically to manage the degree of multiprogramming. Impact: Affects system performance by regulating the presence of processes in main memory.

Multiprogramming Preemption – Process is forcefully removed from CPU. Pre-emotion is also called time sharing or multitasking. Non-preemption – Processes are not removed until they complete the execution. Once control is given to the CPU for a process execution, till the CPU releases the control by itself, control cannot be taken back forcibly from the CPU.

Operation on the Process 1. Creation: The process will be ready once it has been created, enter the ready queue (main memory), and be prepared for execution. 2. Planning: The operating system picks one process to begin executing from among the numerous processes that are currently in the ready queue. Scheduling is the process of choosing the next process to run. 3. Application: The processor begins running the process as soon as it is scheduled to run. During execution, a process may become blocked or wait, at which point the processor switches to executing the other processes. 4. Killing or Deletion: The OS will terminate the process once its purpose has been fulfilled. The process’s context will be over there.

Multiple Choice Questions 1. What is the purpose of the Long-term Scheduler in an operating system? A) Decides process execution order B) Manages context switching C) Determines degree of multiprogramming D) Handles I/O operations 2. Which scheduler runs infrequently and influences the overall system performance? A) Short-term Scheduler B) Long-term Scheduler C) Medium-term Scheduler D) CPU Scheduler

Multiple Choice Questions 3. What does the Short-term Scheduler (CPU Scheduler) primarily decide? A) Degree of multiprogramming B) Process suspension C) Process execution order D) Swapping decisions 4. What is the primary function of the Medium-term Scheduler? A) Determines degree of multiprogramming B) Manages context switching C) Makes decisions about process suspension and swapping D) Allocates CPU time

Multiple Choice Questions 5. When does a process move from the Ready to Running state in the context of scheduling? A) When it completes execution B) When the CPU becomes available C) When it needs to wait for an event D) When a higher-priority process becomes ready 6. What is the primary purpose of context switching in an operating system? A) Allocating CPU time to processes B) Saving and restoring the CPU state for process switching C) Making decisions about process suspension D) Determining the degree of multiprogramming

Multiple Choice Questions 7. In which state does a process wait for an event, such as I/O operation or user input? A) Ready B) Blocked or Wait C) Running D) Terminated 8. When does a process move from the Running to the Ready state? A) When it completes execution B) When it needs to wait for an event C) When preempted by the operating system D) When the CPU becomes available

Multiple Choice Questions 9. What is the role of the dispatcher in the context of scheduling? A) Determines degree of multiprogramming B) Manages context switching C) Allocates CPU time to processes D) Makes decisions about process suspension 10. What does the term "CPU Bound Process" refer to? A) Intensive in I/O operations B) Intensive in CPU operations C) Ready for execution D) Completed its execution