To design a scheduling program to implement a Queue with two levels:
Level 1 : Fixed priority preemptive Scheduling
Level 2 : Round Robin Scheduling For a Fixed priority preemptive Scheduling (Queue 1),
the Priority 0 is highest priority. If one process P1 is scheduled and running,
another process P2 with higher priority comes. The New process (high priority) process P2
preempts currently running process P1 and process P1 will go to second level queue. Time for
which process will strictly execute must be considered in the multiples of 2. All the processes
in second level queue will complete their execution according to round robin scheduling.
Here Queue 2 will be processed after Queue 1 becomes empty.
2. Priority of Queue 2 has lower priority than in Queue 1.
Answers
Answer:
To schedule processes we have two methods, on is preemptive and the other one is non-preemptive, in these two methods of scheduling the need of leaving a process incomplete before completion is known as preemptive, whereas the process of completing the processing and then leaving the processor is known as non-preemptive.
Explanation:
Preemptive method consists of the round robin algorithm, where the processes are given a particular time slice for getting there processes done by the processor, and different processes are known by P1 and P2.
Answer:
# MLFQ
===========================================================
Simulating Multilevel-FeedBack-Scheduling-Queue-in-C++-
===========================================================
This application implements Multilevel Feedback Queue in C++ with two levels:
Level 1 : Fixed priority preemptive Scheduling
Level 2 : Round Robin Scheduling
===========================================================
SYSTEM DETAILS
===========================================================
1. Fixed priority preemptive Scheduling (Queue 1)
* Priority 0 is highest priority.
* Quantum : 4 unit time
* Preemptive:
If one process e.g. P1 is scheduled and running , now another process with higher priority comes e.g. P2. New process(high priority)
process P2 preempts currently running process P1 and process P1 will go to second level queue.
2. Round Robin Scheduling (Queue 2)
* Quantum : 4 unit time
* All the processes in second level queue will complete their execution according to round robin scheduling.
* Queue 2 will be processed after Queue 1 becomes empty.
* Priority of Queue 2 has lower priority than in Queue 1.
Suppose Queue 1 is empty and currently process from Queue 2 is being executed. Now, If at this time a new process arrives then new process will be part of Queue 1. So, new
process should be scheduled as Queue 1 has higher priority than Queue 2. Again after Queue 1 becomes empty Queue 2 will resume execution.
===========================================================
INPUT FORMAT
===========================================================
<pid> <arrival_time> <burst_time> <priority>
===========================================================
OUTPUT FORMAT
===========================================================
<pid Response_Time Finish_Time Waiting_Time >
===========================================================
Sample Input :
===========================================================
5
1 0 14 2
2 7 8 1
3 3 10 0
4 5 7 2
5 1 5 3
===========================================================
Sample Output:
===========================================================
1 0 44 30
2 0 31 16
3 0 41 28
4 6 34 22
5 14 35 29