
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

// screen queue: queue at the screening window // tran queue: priority queue for the transaction windows // event queue: time-ordered queue used by your program to // carry out the simulation
t = 0
while event queue not empty OR input file not empty
t, e = time and event details from file or queue (earliest)
if e is a window close command set window status to closed else if e is a window open command set window status to available generate trytoserve event at t else if e is an incoming transaction display transaction details enqueue transaction to screen queue generate trytodispatch event at t else if e is a trytodispatch event if screen queue is not empty and scrwindow is not busy dequeue transaction x from screen queue set scrwindow status to busy generate dispatch event for x at time t+ endif else if e is a dispatch event display dispatch details set scrwindow status to available generate trytodispatch event at t enqueue transaction to tran queue generate trytoserve event at t else if e is a trytoserve event if tran queue not empty and there is an available window get first available window dequeue transaction x from tran queue set window status to busy display transaction details generate completion event at t + x (where x is the expected length of transaction) generate trytoserve event at t // this may not be necessary endif else if e is a completion event display completion details set window status to available generate trytoserve event at t endif
endwhile