OS Priority Scheduling

Priority Shceduling

Priority Scheduling is a method of scheduling processes that is based on priority. In this algorithm, the scheduler selects the tasks to work as per the priority.

The processes with higher priority should be carried out first, whereas jobs with equal priorities are carried out on a round-robin or FCFS basis. Priority depends upon memory requirements, time requirements, etc.

Types of Priority Scheduling

Priority scheduling divided into two main types:

Preemptive Scheduling

In Preemptive Scheduling, the tasks are mostly assigned with their priorities. Sometimes it is important to run a task with a higher priority before another lower priority task, even if the lower priority task is still running. The lower priority task holds for some time and resumes when the higher priority task finishes its execution.

Non-Preemptive Scheduling

In this type of scheduling method, the CPU has been allocated to a specific process. The process that keeps the CPU busy, will release the CPU either by switching context or terminating. It is the only method that can be used for various hardware platforms. That's because it doesn't need special hardware (for example, a timer) like preemptive scheduling.

Q1. Write a C program to list the processes according to their priority given the process names, burst time of the processes and the priority of the processes. Assume that all processes arrive at time t0. The process names are of type character array, burst time and priority of type integers.

Answer: Click Here

Q2. Write a C Program to compute the waiting time and turnaround time of the list of processes using Priority scheduling algorithm given the process names, their burst times and priority.

Note: If more than one process has same priority then execute based on input order.

Answer: Click Here

Post a Comment