Powered By Blogger

Aug 12, 2024

Example of FCFS CPU Scheduling algorithm

 Evaluate FCFS CPU Scheduling algorithm for given Problem Problem and Average Turn Around Time and Average Response Time  


Process

P1

P2

P3

P4

Process Time

24

3

5

6


Given:

  • Processes:
    • P1: Burst Time = 24 ms
    • P2: Burst Time = 3 ms
    • P3: Burst Time = 5 ms
    • P4: Burst Time = 6 ms
  • Assumption: All processes arrive at the same time (0 ms), as no specific arrival time is provided.

Step 1: Process Execution Order

In FCFS scheduling, processes are executed in the order they arrive. Since all processes are assumed to arrive at the same time, they will be executed in the order they are listed.

Order of Execution:
P1 → P2 → P3 → P4

Step 2: Calculate Completion Time (CT), Turnaround Time (TAT), and Response Time (RT)

  • Completion Time (CT): The time at which each process completes its execution.
  • Turnaround Time (TAT): The total time taken from arrival to completion of a process. TAT=Completion Time (CT)Arrival Time (AT)\text{TAT} = \text{Completion Time (CT)} - \text{Arrival Time (AT)}
  • Response Time (RT): The time from the arrival of the process until it starts executing. Since in FCFS, a process starts execution immediately when the CPU is available, the response time is the same as the waiting time. RT=Start TimeArrival Time (AT)\text{RT} = \text{Start Time} - \text{Arrival Time (AT)}

Execution and Calculations

ProcessBurst Time (BT)Start Time (ST)Completion Time (CT)Turnaround Time (TAT)Response Time (RT)
P124 ms0 ms24 ms24 ms0 ms
P23 ms24 ms27 ms27 ms24 ms
P35 ms27 ms32 ms32 ms27 ms
P46 ms32 ms38 ms38 ms32 ms

Step 3: Average Turnaround Time and Average Response Time

  • Average Turnaround Time (TAT):

    Average TAT=24+27+32+384=30.25 ms\text{Average TAT} = \frac{24 + 27 + 32 + 38}{4} = 30.25 \text{ ms}
  • Average Response Time (RT):

    Average RT=0+24+27+324=20.75 ms\text{Average RT} = \frac{0 + 24 + 27 + 32}{4} = 20.75 \text{ ms}
  • Order of Execution: P1, P2, P3, P4
  • Average Turnaround Time: 30.25 ms
  • Average Response Time: 20.75 ms

No comments:

Post a Comment

Featured Post

Data Analysis

    What is data analysis and its significance?   Data analysis is the process of collecting, transforming, and organizing data to dr...

Popular Posts