EX 3 - Scheduling Algorithms
EX 3 - Scheduling Algorithms
Aim:
Scenario:
Consider a hospital scenario, where the patients are waiting for doctor consultation. Identify
the suitable scheduling algorithm for this scenario and develop a solution to schedule the
patients with respect to their token number. Arrival time of the patient is used to decide the
token number, consultation time with the doctor is the burst time.
a. Compute the waiting time, turnaround time and response time of each patient and
tabulate the results with the Gantt chart.
In the above scenario, let us include the following cases that take less consultation time:
● Vaccination
● Medical representatives
b. Identify the suitable scheduling algorithm for this scenario by giving preferences to
the above cases and develop a solution to schedule the consultations.
c. Compute the waiting time, turnaround time and response time of each patient and
tabulate the results with the Gantt chart.
d. Analyze and report the best scheduling algorithm based on the scheduling criteria.
Sample Learning Outcome:
1. Implement the various CPU scheduling algorithms like FCFS and SJF (P and NP)
2. Calculate the waiting time, response time and turn around time for various scheduling algorithms
Best Practices:
1. Algorithm design
5. Error handling mechanisms for input like burst time, starting time,
7. Modularity
Algorithm:
1. Read the following
a. Number of processes
b. Process IDs
c. Arrival time for each process
d. Burst Time for each process
2. Design a menu with FCFS and SJF options
3. Upon selection of menu option apply the corresponding algorithm.
4. Compute the Turnaround Time, Average waiting Time for each of the algorithm.
5. Tabularize the results.
6. Display the Gantt Chart.
Sample Input & Output:
CPU SCHEDULING ALGORITHMS
1. FCFS
2. SJF
3. EXIT
Enter your option: 1
FCFS CPU SCHEDULER
Number of Processes: 5
Process ID: P1
Arrival Time: 0
Burst Time: 4
-
-
-
-
Process ID: P5
Arrival Time: 6
Burst Time: 3
Output: