G12G_T2_W1 Operating System II PDF

Document Details

SkillfulParabola

Uploaded by SkillfulParabola

Emirates Schools Establishment

Tags

operating systems CPU scheduling algorithms computer science

Summary

This document is a set of lecture slides covering operating systems, focusing on CPU scheduling algorithms. The slides include topics such as FCFS, SJF, Round Robin, and multi-level queue scheduling.

Full Transcript

Chapter 1: Operating System II Section 1: Advanced features of OS Academic year: 2024-2025 Starter  https://create.kahoot.it/details/34211a52-547a-4543-9a13-07bf1ee19a0 e 2 Objectives Recall of principles relating...

Chapter 1: Operating System II Section 1: Advanced features of OS Academic year: 2024-2025 Starter  https://create.kahoot.it/details/34211a52-547a-4543-9a13-07bf1ee19a0 e 2 Objectives Recall of principles relating to OS. Demonstrate the purpose of scheduling. Complete a scheduling algorithm. 3 Keywords 4 Getting Started  Components of the computer system 5 Activity  Name an Operational System 6 Operating System  The main functions of the OS system 7 Activity 1.1.1- Homework 8 CPU Scheduling  A program in execution by a CPU is called a process.  There are different states a process takes during its execution period.  A process can take any of the following states: New, Running, Waiting and Ready. 9 CPU Scheduling New state - The process is created. o Example – When  Process State Diagram OS picks a program present in the secondary memory then a process is created and enters the New state. Ready state – The process is readily waiting to be assigned to the processor. o Example – When the process is loaded into the main memory, the process is ready to run. Running state – The process is getting executed by the CPU. o Example – The CPU will choose a process to execute. Waiting state – The process is waiting for some event to occur. o Example – A process is in a waiting state until an input/output event is completed. 10 Terminated – The process execution is completed. Activity 1.1.2 11 CPU Scheduling  Arrival and Burst time in CPU scheduling Process Times Execution Arrival Burst time time time The time In Process In the AT = CT - BT = TAT - CPU Time I/O Time millisecond execution millisecond process is TAT WT s time s available I/O Process operation AT: Arrival time execution time by the CT: Completion time process TAT: Turning Around Time 12 BT: Burst Time WT: Waiting Time CPU Scheduling Types  Types of CPU scheduling  CPU scheduling decision takes place during the below four Pre- Non- emptive preemptive conditions: 13 Feature Preemptive Scheduling Non-Preemptive Scheduling Can interrupt processes Runs processes to the end without Interruptions anytime. interruptions. Faster response for urgent Responsiveness tasks. Slower response; may cause delays. Complexity More complex to manage. Easier to manage. Example  Round Robin Scheduling ,  First-Come, First-Served (FCFS),  Priority Scheduling  Shortest Job Next (SJN) 14 Activity 1.1.3 Non-preemptive preemptive 15 preemptive CPU Scheduling Algorithms  CPU Scheduling algorithms As you are aware now, CPU scheduling deals with deciding which ready process is allocated to the CPU. 16 CPU Scheduling Algorithms What do you think the algorithm of “First-Come First Serve Scheduling”? First-Come-First-Serve (FCFS) the process that requests the CPU first is allocated the CPU first 17 First-Come-First-Serve (FCFS) 18 CPU Scheduling Algorithms What do you think the algorithm of “Shortest-Job-First Scheduling”? Shortest-Job-First Scheduling (SJF) when CPU is available, it is allocated to the process which has got the smallest CPU burst. 19 Shortest-Job-First Scheduling (SJF) 20 CPU Scheduling Algorithms What do you think the algorithm of “Round-Robin Scheduling”? Define “Time quantum” in range (10- 100) ms All process in ready state After 1 time After 1 After 1 quantum Work on time Work on time Work on process quantum process quantum process 1 2 n When the process is done, 21 it will be Terminated terminated Round-Robin Scheduling Process Burst Time P1 12 P2 8 P3 4 P4 10 P5 5 22 CPU Scheduling Algorithms What do you think the algorithm of “Priority Scheduling”? Priority Scheduling scheduling is based on the priority of the process. Priority is usually decided based on memory, time or any other resource requirements 23 Priority Scheduling 24 CPU Scheduling Algorithms What do you think the algorithm of “Multilevel queue Scheduling”? Multilevel queue scheduling combines “Priority scheduling” and “Round-Robin scheduling”. The processes are arranged in multiple separate queues based on their priority. The Priority scheduling algorithm then selects the process with the highest priority in the queue. 25 CPU Scheduling Algorithms What do you think the algorithm of “Multilevel feedback queue Scheduling”? Multilevel feedback queue scheduling The processes are separated according to the characteristics of their CPU bursts. If a process uses too much CPU time, it will be moved to a lower- priority queue. In addition, a process that waits too long in a lower-priority queue may be moved to a higher-priority queue. 26 Activity 1.1.5 27

Use Quizgecko on...
Browser
Browser