Operating Systems Lesson 5 PDF

Document Details

UseableClimax

Uploaded by UseableClimax

Polytechnic University of the Philippines

Tags

operating systems CPU scheduling algorithms computer science

Summary

This document describes various CPU scheduling algorithms used in operating systems. It explains preemptive and non-preemptive scheduling, along with specific examples such as Shortest Remaining Time First (SRTF) and Round Robin. It's a detailed explanation on computer science.

Full Transcript

There are mainly two types of scheduling methods: Preemptive Scheduling: Preemptive scheduling is used when a process switches from running state to ready state or from the waiting state to the ready state. Non-Preemptive Scheduling: Non-Preemptive scheduling is used when a process terminates ,...

There are mainly two types of scheduling methods: Preemptive Scheduling: Preemptive scheduling is used when a process switches from running state to ready state or from the waiting state to the ready state. Non-Preemptive Scheduling: Non-Preemptive scheduling is used when a process terminates , or when a process switches from running state to waiting state. Is a pre-emptive method of CPU scheduling algorithm that works based on the priority of a process. In this algorithm, the scheduler schedules the tasks to work as per the priority, which means that a higher priority process should be executed first. In case of any conflict, i.e., when there is more than one process with equal priorities, then the pre-emptive priority CPU scheduling algorithm works on the basis of FCFS (First Come First Serve) algorithm. In the Shortest Remaining Time First (SRTF) scheduling algorithm, the process with the smallest amount of time remaining until completion is selected to execute. In Preemptive SJF Scheduling, jobs are put into the ready queue as they come. A process with shortest burst time begins execution. If a process with even a shorter burst time arrives, the current process is removed or preempted from execution, and the shorter job is allocated CPU cycle. The name of this algorithm comes from the round-robin principle, where each person gets an equal share of something in turns. It is the oldest, simplest scheduling algorithm, which is mostly used for multitasking. In Round-robin scheduling, each ready task runs turn by turn only in a cyclic queue for a limited time slice. This algorithm also offers starvation free execution of processes. Time Slice = 2 PROCESSES ARRIVAL TIME BURST TIME ARRIVAL PROCESESS BURST TIME PRIORITY TIME P1 0ms 4ms P1 0ms 8ms 2 P2 3ms 8ms P2 3ms 10ms 1 P3 5ms 5ms P3 10ms 2ms 0 P4 7ms 4ms P4 12ms 5ms 3 P5 10ms 2ms P5 5ms 4ms 4

Use Quizgecko on...
Browser
Browser