- The EnqRequest command adds a request to the set of
pending requests.
COMMAND FORM:
EnqRequest <trackNum>
SPECIFIC EXAMPLE #1:
EnqRequest 5
OUTPUT CORRESPONDING TO EXAMPLE #1:
EnqRequest 5
Current Position: .............. TRACK 1
Current Direction: ............. FORWARD DIRECTION
Request was Enqueued in the: ... FORWARD QUEUE
Number of Request is: .......... 42
============================================================================
SPECIFIC EXAMPLE #2:
EnqRequest 3
OUTPUT CORRESPONDING TO EXAMPLE #2:
EnqRequest 3
Current Position: .............. TRACK 7
Current Direction: ............. FORWARD DIRECTION
Request was Enqueued in the: ... REVERSE QUEUE
Number of Request is: .......... 43
============================================================================
- The ServeRequest command simulates the actions that the
scheduler takes when it processes the request for service whose turn is
next. In 'real life' each such request would ask the scheduler to store
data to some particular track or fetch data from some particular track.
COMMAND FORM:
ServeRequest
SPECIFIC EXAMPLE:
ServeRequest
EXAMPLE OF THE CORRESPONDING OUTPUT:
Position Prior to Serve Operation: ... Track 9
Direction Prior to Serve Operation: .. REVERSE DIRECTION
The Request was Served from the: ..... REVERSE QUEUE
Track Number of Request: ............. 5
Number of Request: ................... 42
Position After Serve Operation: ...... Track 5
Direction After Serve Operation: ..... REVERSE DIRECTION
============================================================================
- The PrintState command prints everything important about
the current situation:
- the current position of the disk arm,
- the scheduler's current direction setting
- the name of the queue from which the scheduler is currently
set to serve,
- the list of waiting requests in the order in which they will
be served if no more requests for service are made. (It is the same
order obtained by emptying the queues with repeated deletions - first
the queue for the current direction and then the other one.)
COMMAND FORM:
PrintState
SPECIFIC EXAMPLE:
PrintState
EXAMPLE OF THE CORRESPONDING OUTPUT:
PrintState
Current Position: .............. TRACK 7
Current Direction: ............. FORWARD DIRECTION
Current Queue: ................. FORWARD QUEUE
Contents of FORWARD QUEUE:
Track Request Number
7 51
7 54
8 49
8 53
9 37
Contents of REVERSE QUEUE:
Track Request Number
7 58
6 48
5 57
5 60
2 38
0 40
0 50
============================================================================
- The Quit command must cause the program to Halt.
COMMAND FORM:
Quit
SPECIFIC EXAMPLE:
Quit
EXAMPLE OF THE CORRESPONDING OUTPUT:
Quit
Quit command received ... exiting.
============================================================================
Your final source code and your test
script. I will compile and test your programs
on the suns in the lab.