You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case of `RoundRobin`, you must first set a time quantum before calling `process`.
38
+
34
39
```java
35
40
CPUScheduler rr = new RoundRobin();
36
41
@@ -43,9 +48,32 @@ rr.setTimeQuantum(2);
43
48
rr.process();
44
49
```
45
50
51
+
### Rows
52
+
53
+
Using the object's `getRows` method will return a `List` of all queued `Row`. After `process`, each `Row` will reflect their respective computed *waiting time* and *turnaround time*.
54
+
55
+
```java
56
+
CPUScheduler sjf = new ShortestJobFirst();
57
+
List<Row> rows;
58
+
59
+
sjf.add(new Row("P1", 0, 5));
60
+
sjf.add(new Row("P2", 2, 4));
61
+
62
+
rows = sjf.getRows();
63
+
rows.get(1).getWaitingTime(); // 0
64
+
rows.get(1).getTurnaroundTime(); // 0
65
+
66
+
sjf.process();
67
+
68
+
rows = sjf.getRows();
69
+
rows.get(1).getWaitingTime(); // 3
70
+
rows.get(1).getTurnaroundTime(); // 7
71
+
```
72
+
46
73
### Timeline
47
74
48
75
Using the object's `getTimeline` method will return a `List` of `Event` which can be used to draw a Gantt chart. The timeline shows what job is being processed at the given time.
0 commit comments