- 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 told to perform the service
for the pending request that is next in the priority ordering.
In a real application, the request would be for copying some
data from a disk track to primary memory, or for copying information
from primary memory to a disk track.
To execute the ServeRequest command, the scheduler will serve the
next request from the current queue, unless that queue is empty. If it
is empty, the scheduler will reverse directions and serve the next
request from the other queue. This is the only situation in which the
scheduler is allowed to change directions.
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.
============================================================================