0% found this document useful (0 votes)
11 views6 pages

Code Checking File 2

test file to test code

Uploaded by

debnathshreosi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Code Checking File 2

test file to test code

Uploaded by

debnathshreosi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

In this program, we will implement a round-robin CPU scheduling simulator.

The
input to your
simulator will be a set of processes and a time slice. Each process will be
described by an id, arrival time
and CPU burst. Your simulator will simulate RR scheduling on these processes and
for each process it
will calculate its start time and finish time. Your simulator will also compute a
condensed execution
sequence of all processes. You will implement your simulator as a function
simulate_rr() with the
following signature

# Round Robin CPU Scheduler Simulator - starter code for Assignment 4

To compile all code, type:


```
$ make
```

To run the resulting code on file [Link] with quantum=3 and max. execution
sequence length of 20:
```
$ ./scheduler 3 20 < [Link]
```

## IMPORTANT

Only modify and submit the `[Link]` file. Your TAs will
supply their own versions of the other files (such as [Link]) to
compile and test your code.

## Test files

The repository includes several test files. Here are correct results for these test
files.

```
$ ./scheduler 3 20 < [Link]
seq = [0,1,2,3,0,4,1,3]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 0 | 6 | 0 |
15 |
| 1 | 0 | 6 | 3 |
20 |
| 2 | 1 | 3 | 6 |
9 |
| 3 | 2 | 8 | 9 |
25 |
| 4 | 3 | 2 | 15 |
17 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 3 20 < [Link]


seq = [-1,0,1,0,2,1,0]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 1 | 10 | 1 |
19 |
| 1 | 3 | 5 | 4 |
15 |
| 2 | 5 | 3 | 10 |
13 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 1 20 < [Link]


seq = [-1,0,1,0,1,2,0,1,2,0,1,2,0,1,0]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 1 | 10 | 1 |
19 |
| 1 | 3 | 5 | 4 |
16 |
| 2 | 5 | 3 | 7 |
14 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 1 5 < [Link]


seq = [-1,0,1,0,1]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 1 | 10 | 1 |
19 |
| 1 | 3 | 5 | 4 |
16 |
| 2 | 5 | 3 | 7 |
14 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 100 20 < [Link]


seq = []
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 300000000000 40 < [Link]


seq = [-1,0,1,0,2,1,0]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 100000000000 | 1000000000000 | 100000000000 |
1900000000000 |
| 1 | 300000000000 | 500000000000 | 400000000000 |
1500000000000 |
| 2 | 500000000000 | 300000000000 | 1000000000000 |
1300000000000 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 30000000000 1000 < [Link]


seq = [-
1,0,1,0,1,0,1,0,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,2,1,0,1,0
,1,0,1,0]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 100000000000 | 1000000000000 | 100000000000 |
1900000000000 |
| 1 | 300000000000 | 500000000000 | 310000000000 |
1590000000000 |
| 2 | 500000000000 | 300000000000 | 550000000000 |
1390000000000 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 1 40 < [Link]


seq = [-
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 100000000000 | 1000000000000 | 100000000000 |
1900000000000 |
| 1 | 300000000000 | 500000000000 | 300000000001 |
1600000000000 |
| 2 | 500000000000 | 300000000000 | 500000000002 |
1400000000000 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 1 40 < [Link]


seq = [-1,0,1,0,1,0,1,0,1,0,1,2,0,1,0,-1,3]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 5 | 10 | 5 |
22 |
| 1 | 6 | 6 | 7 |
19 |
| 2 | 14 | 1 | 16 |
17 |
| 3 | 50 | 17 | 50 |
67 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 3 40 < [Link]


seq = [-1,0,1,0,1,0,2,0,-1,3]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 5 | 10 | 5 |
22 |
| 1 | 6 | 6 | 8 |
17 |
| 2 | 14 | 1 | 20 |
21 |
| 3 | 50 | 17 | 50 |
67 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 157 140 < [Link]


seq = [-1,0,1,2,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,3,4,-
1,5]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 10 | 1000 | 10 |
4464 |
| 1 | 30 | 1000 | 167 |
4522 |
| 2 | 100 | 1000 | 324 |
4580 |
| 3 | 500 | 1000 | 952 |
4952 |
| 4 | 501 | 1000 | 1109 |
5010 |
| 5 | 5000000 | 1 | 5000000 |
5000001 |
+---------------------------+----------------------+----------------------
+----------------------+
$ ./scheduler 1 200 < [Link]
seq = [-1,0,1,-1,2,3,-1,4,5,4,5,4,5,4,5,4,5,4,5,4,5,4,-1,6]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 20 | 1 | 20 |
21 |
| 1 | 20 | 10 | 21 |
31 |
| 2 | 1000 | 1 | 1000 |
1001 |
| 3 | 1000 | 10 | 1001 |
1011 |
| 4 | 2000 | 2000 | 2000 |
4007 |
| 5 | 2005 | 7 | 2006 |
2019 |
| 6 | 6000 | 1 | 6000 |
6001 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 5 200 < [Link]


seq = [-1,0,1,-1,2,3,-1,4,5,4,5,4,-1,6]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 20 | 1 | 20 |
21 |
| 1 | 20 | 10 | 21 |
31 |
| 2 | 1000 | 1 | 1000 |
1001 |
| 3 | 1000 | 10 | 1001 |
1011 |
| 4 | 2000 | 2000 | 2000 |
4007 |
| 5 | 2005 | 7 | 2010 |
2022 |
| 6 | 6000 | 1 | 6000 |
6001 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 5555 200 < [Link]


seq = [-1,0,1,-1,2,3,-1,4,5,-1,6]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 20 | 1 | 20 |
21 |
| 1 | 20 | 10 | 21 |
31 |
| 2 | 1000 | 1 | 1000 |
1001 |
| 3 | 1000 | 10 | 1001 |
1011 |
| 4 | 2000 | 2000 | 2000 |
4000 |
| 5 | 2005 | 7 | 4000 |
4007 |
| 6 | 6000 | 1 | 6000 |
6001 |
+---------------------------+----------------------+----------------------
+----------------------+

$ ./scheduler 1 50 < [Link]


seq = [-
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
,1,0,1,0,1,0,1,0]
+---------------------------+----------------------+----------------------
+----------------------+
| Id | Arrival | Burst | Start |
Finish |
+---------------------------+----------------------+----------------------
+----------------------+
| 0 | 10000000000 | 100000000000 | 10000000000 |
160000000150 |
| 1 | 11000000000 | 10000000010 | 11000000001 |
67300000057 |
| 2 | 12000000000 | 10000000020 | 12000000002 |
69800000108 |
| 3 | 13000000000 | 10000000030 | 13000000003 |
71133333482 |
| 4 | 14000000000 | 10000000040 | 14000000004 |
71883333513 |
| 5 | 15000000000 | 10000000050 | 15000000005 |
72283333534 |
+---------------------------+----------------------+----------------------
+----------------------+
```

You might also like