3 Implementation of CPU Scheduling Policies: FCFS and SJF (Nonpreemptive and Preemptive)
Develop a menu driven C program to implement the CPU Scheduling Algorithms
FCFS and SJF (Non-Preemptive and Preemptive)
Sample Learning Outcome:
- Learn about the CPU Scheduling algorithms FCFS and SJF.
- Implement the sorting algorithms necessary for scheduling and analyzing the performance using waiting time, turn around time and response time.
- Learn to draw the Gantt Chart Best Practices:
- Algorithm design
- Naming convention for file names, variables
- Comment usage at proper places
- Prompt messages during reading input and displaying output
- Error handling mechanisms for failures in system calls
- Incremental program development
- Modularity
- All possible test cases in output
Algorithm:
- Read the following
- Number of processes
- Process IDs
- Arrival time for each process
- Burst Time for each process
- Design a menu with FCFS and SJF options
- Upon selection of menu option apply the corresponding algorithm.
- Compute the average turnaround time, average waiting time and average response time for each of the algorithm.
- Tabularize the results.
- Display the Gantt Chart.
Sample Input & Output:
CPU SCHEDULING ALGORITHMS
- FCFS
- SJF
- 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:
| P1 |
0 4
| P1 | 0 | 4 *** *** *** |
| *** | *** | *** *** *** *** |
| ****** | ||
| Average *** *** |
Process ID Arrival Time Burst Time Turnaround Time Waiting Time Response Time
Want to Continue ( Y/N): Y
CPU SCHEDULING ALGORITHMS
- FCFS
- SJF
- EXIT
Enter your option: 2
SJF CPU SCHEDULER
- Non preemptive SJF
- Pre emptive SJF
Enter your option: a
Number of Processes: 5
Process ID: P1
Arrival Time: 0
Burst Time: 4
Process ID: P5
Arrival Time: 6
Burst Time: 3
Output:
| P1 |
0 4
| *** | *** | *** | *** | *** | |
| ********* | *** | *** | *** | *** | |
| Average | *** | *** |
Process ID Arrival Time Burst Time Turnaround Time Waiting Time Response Time

![[Solved] UCS1411 Exercise 3- Nonpreemptive and Preemptive](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] UCS1411 Exercise 4-Priority and Round Robin](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.