Question: Operating Systems - These questions are regarding a state machine I have been running simulating a game of hide and seek complete with numbers of

Operating Systems - These questions are regarding a state machine I have been running simulating a game of hide and seek complete with numbers of players, hiding spots and more. Its using a STM language and some Python. The UML diagram jpg for the state machine is attached.

Question 1

Every time "make test" successfully runs the simulation, we get the same output game results in hideAndSeek.out:

$ cat hideAndSeek.out 000000001543,MSG,thread 0 process 0,0 Thread TAGGED 23 out of 100 000000001543,MSG,thread 1 process 0,1 Thread TAGGED 18 out of 100 000000001543,MSG,thread 2 process 0,2 Thread TAGGED 23 out of 100 000000001543,MSG,thread 3 process 0,3 Thread TAGGED 13 out of 100 000000001543,MSG,thread 4 process 0,4 Thread TAGGED 23 out of 100

How is it possible that each thread gets tagged the exact same number of times in each test run, despite all the calls to the pseudo-random number generator sample() in STM model hideAndSeek.stm?

Operating Systems - These questions are regarding a state machine I have

Question 2:

There are some variables in the state machine that have "pcb." as a prefix such as "pcb.players" while others such as numberOfPlayers do not have this. Why do only some variables have pcb while others do not?

processor: init:0 thread-init:3 init:0 init:0 processor:making Processes: 1 fork:0 thread:initThread:4 Fork: 1 cpu:0 processor processor Done:2 thread:loopAnd Spawn:5 spawn:0 pu: 1 spawn:1 threadwait For Others ToStart:6 cpu:0 cpu: 1 thread:see Wholsit:7 cpu: 1 cpu:0 cpu:2/cpu:1 cpu:3 Someone WasTagged:0 thread:endGame:10 thread:lamSeeking:8 cpu:0 thread:lamHiding:9 processor: init:0 thread-init:3 init:0 init:0 processor:making Processes: 1 fork:0 thread:initThread:4 Fork: 1 cpu:0 processor processor Done:2 thread:loopAnd Spawn:5 spawn:0 pu: 1 spawn:1 threadwait For Others ToStart:6 cpu:0 cpu: 1 thread:see Wholsit:7 cpu: 1 cpu:0 cpu:2/cpu:1 cpu:3 Someone WasTagged:0 thread:endGame:10 thread:lamSeeking:8 cpu:0 thread:lamHiding:9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!