[SOLVED] UCS1411 Exercise 3- Nonpreemptive and Preemptive

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon ex3-FCFS-SJF-vxd71y.zip (115.4 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

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:

  1. Learn about the CPU Scheduling algorithms – FCFS and SJF.
  2. Implement the sorting algorithms necessary for scheduling and analyzing the performance using waiting time, turn around time and response time.
  3. Learn to draw the Gantt Chart Best Practices:
  4. Algorithm design
  5. Naming convention – for file names, variables
  6. Comment usage at proper places
  7. Prompt messages during reading input and displaying output
  8. Error handling mechanisms for failures in system calls
  9. Incremental program development
  10. Modularity
  11. All possible test cases in output

Algorithm:

  1. Read the following
    1. Number of processes
    2. Process IDs
    3. Arrival time for each process
    4. 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 average turnaround time, average waiting time and average response 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:

              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

  1. FCFS
  2. SJF
  3. EXIT

Enter your option: 2

SJF CPU SCHEDULER

  1. Non preemptive SJF
  2. 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

  • ex3-FCFS-SJF-vxd71y.zip