Priority CPU Scheduling Problem
Given 'N' processes with their “burst times”, where the “arrival time” for all processes is ‘0’, and the ‘priority’ of each process, your task is to compute the “waiting time” and the “turn-around time” for each process using the ‘Priority CPU Scheduling’ algorithm.
Processes are scheduled based on priority, with the highest priority being scheduled first. If two processes have the same priority, execute the process with the lower process ID first.
Example:
Input:
T = 1
N = 3
Burst times = [10, 5, 8]
Priorities = [2, 1, 3]
Output:
Waiting Time: [5, 0, 13]
Turn-Around Time: [15, 5, 21]
Constraints:
- 1 <= T <= 10
- 1 <= N <= 104
- 1 <= BURST[i], PRIORITY[i] <= 104
Note:
No need to print anything; focus on implementing the function.
Implement Priority CPU Scheduling algorithm to compute waiting time and turn-around time for processes.
Implement a function that takes in burst times, priorities, and number of processes as input
Sort ...read more
Top Paytm Front end Developer interview questions & answers
Popular interview questions of Front end Developer
Reviews
Interviews
Salaries
Users/Month