Skip to content

Commit f6a21d4

Browse files
authored
Update README.md
1 parent 06529ab commit f6a21d4

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
1-
# cpu-sheduling
2-
cpu sheduling algorithm implemented in python
1+
# CPU Scheduling Algorithms
2+
3+
This GitHub repository contains Python implementations of various CPU scheduling algorithms. The current implementation includes the First Come First Serve (FCFS) algorithm.
4+
5+
## First Come First Serve (FCFS)
6+
7+
### Introduction
8+
FCFS is a non-preemptive scheduling algorithm that schedules processes based on their arrival time. The process that arrives first is the first to be executed.
9+
10+
### Implementation
11+
12+
The `CpuScheduling` class is used to represent the CPU scheduling algorithms. The FCFS algorithm is implemented in the `fcfs` method.
13+
14+
*current implementation can only handle unique arrival times*
15+
16+
### Usage
17+
18+
To use the FCFS algorithm with a specific set of processes, arrival times, and burst times, create an instance of the `CpuScheduling` class and call the `fcfs` method.
19+
20+
```python
21+
prcs = ["P1", "P2", "P3", "P4", "P5"] # process
22+
at = [0, 1, 2, 3, 4] # arrival time
23+
bt = [8, 1, 3, 2, 6] # burst time
24+
schedule = CpuScheduling(prcs, at, bt)
25+
schedule.fcfs()
26+
```
27+
28+
### Output
29+
30+
The FCFS algorithm will display the order of process execution, completion time, turn around time, and waiting time in a tabular format.
31+
32+
Feel free to explore other CPU scheduling algorithms by extending the `CpuScheduling` class and implementing additional methods for Shortest Job First (SJF), Shortest Remaining Time First (SRTF), and Round Robin (RR) algorithms.
33+
34+
Happy coding!

0 commit comments

Comments
 (0)