It must wait for all other processes on that barrier to synchronise and go through together.
Describe Process Abstraction.
Taking a group of smaller processes and their internal channels and encasing this within one bigger process which can connect to the outer channels and act as a black box to hide the internals of the smaller processes.
What is a Sequential Protocol
You declare a channel to carry a sequence of type (semi-colon separated list of previously declared types)
What is a variant/case protocol?
We send a variety of structures down a single channel which is prefixed by a user-defined tag.
What does an ALT do?
It holds a number of guards and chooses to run the first available process that becomes ready.
What does "?" represent in Occam?
What does "!" represent in Occam?
What can be guarded in an ALT?
SKIP (always ready)
What is deadlock?
All synchronisations are incomplete in a network. All resources are trying to be accessed but no resource is responding because it is busy.
What is livelock?
All processes are busy working but blocking any interaction from external input. It could be in an infinite loop.
How would you write a simple Pause process with a timer in Occam?
PROC pause (VAL INT delay)
tim ? t
tim ? AFTER t PLUS delay
What is a multiplexer?
A process which takes several input channels and outputs them individually along one output channel.
In an ALT, explain what the SKIP guard does
It is always TRUE, therefore, unless another guard is ready, the system will always follow the SKIP guard.
What is the difference between ALT and PRI ALT?
PRI ALT - Prioritised choice, ordered in terms of priority.
ALT - Arbitrary choice, based on whichever guard is ready first.
Where should we normally declare variables for better coding practice?
As tight to the area where the variable is used as possible.
(It is bad engineering practice for things to be constructed where they are not needed.)
What is a pre-conditioned guard?
A guard in an ALT or PRI ALT that has a boolean condition attached to it.
(a = 42) & in ? x
out ! x
in.1 ? x
out ! x
How would we program a buffer? (without using sequential id processes)
PROC buffer (CHAN INT in?, out!, CHAN BOOL request?)
INT lo, hi, size:
lo, hi, size := 0, 0, 0
(size < max) & in ? hold[hi]
hi := (hi + 1) max
size := size + 1
(size > 0) & request ? any
out ! hold[lo]
lo := (lo +1)max
size := size - 1
In order to create a buffer, what do we need?
INT max - The maximum size of the array
INT size - Keeps a record of how big the array is so that it can compare this to the 'max' variable
INT hi - Keeps a record of the highest array record being used.
INT lo - Keeps a record of the lowest array record being used.
[max]INT array - The main buffer.
How do you write a replicated ALT?
ALT i = 0 FOR n
replacing n with any value
Is it legal to nest an ALT inside a PRI ALT?
Is it legal to nest a PRI ALT inside an ALT?
Why might you want to nest an ALT inside an ALT?
It makes ALT between single input channels and an array of input channels easier.
We can use a replicated ALT to represent the array of channels and then use a single ALT guard to guard the single input.
When using a Shared channel. In order for an individual process to use this channel (for output say), they must first do what to it?
How would you write inheritance if Protocol C inherited protocol A and B?
PROTOCOL c EXTENDS a, b:
If Protocol A and Protocol B output to a channel that carries Protocol C. How might this be able to work?
It will work if Protocol C inherits both Protocol A and Protocol B. Otherwise, error.