CO538 Concurrency Design and Practice

Card Set Information

Author:
ianholden
ID:
213343
Filename:
CO538 Concurrency Design and Practice
Updated:
2013-04-30 06:02:18
Tags:
Concurrency Design Practice
Folders:

Description:
Cards of CO538 Concurrency Design and practice
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user ianholden on FreezingBlue Flashcards. What would you like to do?


  1. A process' data and algorithm is...

    a) Private
    b) Public

    ...to the outside world
    Private
  2. How can one process get through a barrier?
    It must wait for all other processes on that barrier to synchronise and go through together.
  3. 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.
  4. What is a Sequential Protocol
    You declare a channel to carry a sequence of type (semi-colon separated list of previously declared types)
  5. What is a variant/case protocol?
    We send a variety of structures down a single channel which is prefixed by a user-defined tag.
  6. What does an ALT do?
    It holds a number of guards and chooses to run the first available process that becomes ready.
  7. What does "?" represent in Occam?
    Input
  8. What does "!" represent in Occam?
    Output
  9. What can be guarded in an ALT?
    • Input (?)
    • Timer (timeout)
    • SKIP (always ready)
  10. 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.
  11. What is livelock?
    All processes are busy working but blocking any interaction from external input. It could be in an infinite loop.
  12. How would you write a simple Pause process with a timer in Occam?
    • PROC pause (VAL INT delay)
    •     TIMER tim:
    •     INT t:
    •     SEQ
    •          tim ? t
    •          tim ? AFTER t PLUS delay

    :
  13. What is a multiplexer?
    A process which takes several input channels and outputs them individually along one output channel.
  14. 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.
  15. 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.
  16. 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.)
  17. What is a pre-conditioned guard?
    A guard in an ALT or PRI ALT that has a boolean condition attached to it.

    Example:

    • PRI
    •     (a = 42) & in ? x
    •         out ! x
    •     in.1 ? x
    •         out ! x 
  18. How would we program a buffer? (without using sequential id processes)
    • PROC buffer (CHAN INT in?, out!, CHAN BOOL request?)
    •     [max]INT hold:
    •     INT lo, hi, size:
    •     SEQ
    •         lo, hi, size := 0, 0, 0
    •         WHILE TRUE
    •             ALT
    •                 (size < max) & in ? hold[hi]
    •                     SEQ
    •                         hi := (hi + 1) max
    •                         size := size + 1
    •                 BOOL any:
    •                 (size > 0) & request ? any
    •                     SEQ
    •                         out ! hold[lo]
    •                         lo := (lo +1)max
    •                         size := size - 1
    • :
  19. 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.
  20. How do you write a replicated ALT?
    ALT i = 0 FOR n

    replacing n with any value
  21. Is it legal to nest an ALT inside a PRI ALT?
    Yes
  22. Is it legal to nest a PRI ALT inside an ALT?
    No
  23. 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.
  24. 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?
    CLAIM it!
  25. How would you write inheritance if Protocol C inherited protocol A and B?
    PROTOCOL c EXTENDS a, b:
  26. 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.

What would you like to do?

Home > Flashcards > Print Preview