const M = 3
TURNSTILE = (passenger -> TURNSTILE).
CONTROL = CONTROL[0],
CONTROL[i:0..M] = (when (i
|when (i==M) depart -> CONTROL[0]).
CAR = (depart -> CAR).
||ROLLERCOASTER = (TURNSTILE || CONTROL || CAR).
A museum allows visitors to enter through the east entrance and leave through its west exit. Arrivals and departures are signaled to the museum controller by the turnstiles at the entrance and exit. At opening time, the museum director signals the controller that the museum is open and then the controller permits both arrivals and departures. At closing time, the director signals that the museum is closed, at which point only departures are permitted by the controller. Give that it consists of the four processes EAST, WEST, CONTROL and DIRECTOR, draw the structure diagram for the museum and decide which should be threads and which should be monitor(s).
Represent the above case using FSP and justify your selection of monitor(s).
const N = 4
EAST = (arrive -> EAST).
WEST = (leave -> WEST).
DIRECTOR = (open -> DIRECTOR | close -> DIRECTOR).
CONTROL = CLOSED[0],
CLOSED[i:0..N] = (when (i==0) open -> OPENED[0]
|when (i>0) leave -> CLOSED[i-1]),
OPENED[i:0..N] = (close -> CLOSED[i] | when (i
||MUSEUM = (EAST || CONTROL || WEST).