XML

kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for parallelism

2003

Question 20 (2003):

My part 2 of the assessment will not work. I have tried everything and, despite being able to get it to compile, nothing I can do can get the keyboard input to have the desired effect. I have proved that the keyboard input is being read, but I don't know why it's not running the rest of the program as it should

    [snip code]

... am I right in thinking that once it has outputted 0 down either the `n' or `i' channel, it should then come out of the process and go back to my `q4' process (where it was called from), and thus go on to execute the whole number sequence thing but with the values of 0 waiting to be inputted on either the `numbers.reset' or `integrate.reset' processes.

I ask because no matter how I seem to plug these processes together (each one making its own sense), they don't seem to work!!

Answer 20:

Removing some of your code, and assuming you fed it `i' on the keyboard, you are left with a process that behaves something like:

    CHAN OF INT i:
    SEQ
      i ! 0

This immediately deadlocks. The reason is that the channel you are trying to output on is unconnected -- there is no parallel process performing the corresponding input (remember that channel communication in occam is a synchronous action, as well as a communication -- i.e., both the inputting and outputting processes must wait for each other before the communication can take place).

The `q4.occ' file shows (in ASCII art), the process network that ought to be constructed:

                               |
                               v keyboard
   ____________________________|___________________________________
  |                            |                                   |
  |                       _____|_____                              |
  |            __________|           |                             |
  |           /      'n' |  monitor  |                             |
  |          /           |___________|                             |
  |         v                  | 'i'                               |
  |        /                   v                                   |
  |   ____/____     /|    _____|_____     /|    _______            |
  |  |         |   / |   |           |   / |   |       |           |
  |  | numbers |->-  |->-| integrate |->-  |->-| pairs |\          |
  |  |_________|   \ |   |___________|   \ |   |_______| \         |
  |                 \|\                   \|\             \        | error
  |                    \________             \             \     ------>--
  |                             v             v             v      |
  |                            __\_____________\_____________\__   |
  |                           |                                 |  | screen
  |                           |         layout.max.chans        |------>--
  | q4                        |_________________________________|  |
  |________________________________________________________________|

Thus, taking code straight from the diagram, the PROC header for this particular `monitor' process should be of the form:

    PROC monitor (CHAN OF BYTE keyboard, CHAN OF INT to.numbers, to.integrate)

... and the monitor process resets the numbers and integrate processes by communicating on the channels given to it as parameters. The actual channels used are part of the `q4' process (i.e. should be declared there) -- as can be seen in the diagram.

Keywords: q4 , parallelism

2001

Question 28 (2001):

WOW!!! I just found:

http://wotug.ukc.ac.uk/parallel/

It's an amazing site!! Why on earth you didn't mention that in the first lectures?!?! :))) I'm sure I'm not the only student who finds parallel programming interesting. Thanks. :)

Answer 28:

Thanks for the commendation! Yes, we put a lot of work into that a while back. Sadly, Dave Beckett (whose idea this all was) left us to join another team at Bristol University and we have had no funding to continue maintenance. You will notice its last modified date (01/03/2000) and that some of its links no longer work. It remains useful though, so we are keeping it on-line (but are no longer pushing it at the world ...).

Keywords: parallelism , wotug

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:28 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.