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 exams

2011

Question 72 (2011):

Submission reference: IN2143

hi, with regards to the exam, what would happen if we were to answer all the questions in part B, instead of only answering two?

Answer 72:

Part B has three questions and the rubric says to answer exactly two of them. If you answer three, I don't know the official answer. However, what has (I think) usually happened in the past is that all three answers will be marked and the two with the highest marks will be accepted as your formal answers (i.e. the answer with the lowest mark will be discarded).

Please note that this is not an official answer. For an official answer to the procedures for managing exam rubric errors by candidates, you must ask the University Exams Office.

Keywords: exams

2009

Question 39 (2009):

Submission reference: IN1839

The coursework in Co538 is probably the most time consuming of all modules, I don't mind I think it's fun, however it seems very unfair that only 20% of the marks are coursework.

Why are there so many marks associated to a few hours long exam when our programming tasks will take us many more hours and probably show more our level of in depth understanding.

It would be nice to get an explanation of your thoughts on this matter. Thanks.

Answer 39:

The aim of the coursework is to let you explore in depth the ideas being presented in the lectures. Without this, any learning you do will be fragile and untested. Doing the coursework lets you discover what you don't understand, since solutions cannot be found without real understanding. Without doing the coursework, you will not discover that you have not understood something and, therefore, will not be able to correct that misunderstanding.

Also, we hope that the coursework will be fun – and are glad that you and finding it so, :). Fun is essential for most things, so we try to make the coursework interesting and fun since we really want you to want to do this work ... because we really want you to understand!

Now, hours! Assuming a 40 hour working week (most of us work much longer!) and 4 modules to study during term, that's 10 hours per week per module. This module has 3 contact hours per week (2 lectures, 1 seminar), so that's 7 hours per week for your own study on this module. Some of that will be spent reading the slides, background papers and talking to / teaching / learning from colleagues. Much of the former will be driven by solving the challenges set out in the coursework. The last two coursework assignments span several weeks (at least three), so it should not be surprising that each may take between 10-15 hours – maybe less, maybe more.

Now, exams! For this module, this is 3 hours work during the exam ... but, of course, an awful lot more in preparation for it. In fact, all the work you spend on your coursework is preparation for your exam. You cannot succeed in your exams without understanding – in depth – the material and, as reasoned above, you cannot do that without the coursework.

Therefore, if the coursework were zero weighted, you would have just as much motivation for doing it. Note that in my definition of the aim of our coursework, the grading of students is not included. Grading is the purpose of the exams, which provides a level playing field for every student in conditions where there is a recorded audit trail of how the work is produced and how it is graded (that can be, if necessary, challenged).

The exam seeks to let the student demonstrate understanding of the concepts and mechanisms presented in the module. It does this by asking for simple explanations and by applying them to solve short problems (that are either hard or impossible to solve without that understanding). The exam does not expect or seek a rote reproduction of material from, say, the course slides. The exam will not penalise trivial mistakes in syntax, say, that would not be made if a compiler were to hand – or, indeed, any material available from the web (e.g. the course slides). It's the ability to explain and apply that is all important. And that is very difficult to achieve without doing the coursework.

Summary: the coursework is there to help you learn, the exam is there for you to show us that you have learnt. It's not just the 20% from your marked coursework that is the achievement of all that coursework. It's the 80% from your exam, which would be near impossible without it.

Keywords: coursework , exams

2008

Question 71 (2008):

Submission reference: IN1758

Are we expected to know about barriers for the exam ? Or is that more advanced material like mobiles? Thanks,

Answer 71:

Barriers are in the mobiles.ppt set of slides. Nothing in mobiles.ppt is examinable – it is only for any who are curious to learn more, :).

Keywords: exams


Question 69 (2008):

Submission reference: IN1755

Are we expected to know about graceful termination for this year's exam?

Answer 69:

Nope! That paper is for background reading and not directly examinable. Reading it, however, may deepen your understanding of the fundamental issues being learnt.

Keywords: exams


Question 68 (2008):

Submission reference: IN1754

Hi there, I was wondering for the exam, are we likely to be awarded any marks for drawing process network diagrams, to supplement any code we might be asked to write ? Thanks very much.

Answer 68:

Unless the question specifically asks for a diagram, there wouldn't be any additional marks for these. However, if a question asks you to write the code for a particular process network, drawing a diagram may be a good place to start — if the code is wrong, but the diagram is right, you would likely get more (though not full) marks than if the diagram was not there [because you essentially know what to do]. This would not apply if the diagram was given in the exam paper, or in an answer to another part of the same question.

Keywords: exams


Question 63 (2008):

Submission reference: IN1738

Do we need to worry too much about Test-Rig Design in regards to the exam? Thanks.

Answer 63:

You are expected to know all the motivation and mechanisms underlying process-oriented design (i.e. all the occam-pi material covered in the course, except for the slides on mobiles) – and be fluent and comfortable enough in that knowledge to be able to apply them in scenarios not seen before.

So, you do need to understand the principles underlying that Test-Rig (as one example of good application). However, we do not expect you to memorise things by rote learning!

Keywords: exams


Question 21 (2008):

Submission reference: IN1561

I've been working through the seminar questions and would like to check my answers for question 5, specifically relating to the correct output for x4. Can this be made available?

Answer 21:

The answer (this is for 2004, Co516, Q5, part g) is: 1, 2, 3, 4, ... (until an interrupt arrives - then deadlock).

Keywords: exams

2007

Question 73 (2007):

Submission reference: IN1459

I know what the symbol ? means. Can you explain me what the symbol ?? means? Also at the end of the module we have been taught some Java multi threaded features. Are they examinable? Because I have never came across them in past papers.

Answer 73:

The ?? introduces an extended rendezvous block – see slides 52-61 of the shared-etc slides.

As announced at the end of the lectures, the JCSP/Java material is not examinable.

Keywords: exams , extended-rendezvous


Question 72 (2007):

Submission reference: IN1458

Reference to Question 69 (2007) and Question 70 (2007): monitor.2 accepts a channel gather?. Using an ALT command, I check if there is data on that channel:

  gather ? angle; value

If there is, how can I pass the angle and value to the subprocess monitor? I think that the solution is like:

  CHAN R.DATA input.to.monitor2 IS gather:

Answer 72:

To pass on angle and value to the subprocess monitor, simply output it. Your suggestion of using an abbreviation to rename the gather channel to something with a plausible sounding name won't help.

OK - here's a solution. First the monitor.2 process, implemented by a pipeline of watchdog then monitor:


             -----------------------------------------------------
             |                                                   |
             |    --------------                 -------------   |
    gather   |    |            |        c        |           |   |    report
    --->-----|----|  watchdog  |-------->--------|  monitor  |---|------>---
	     |    |  (period)  |                 |           |   |
	     |    |            |                 |           |   |
             |    --------------                 -------------   |
             |           |                                       |
             |           |                   monitor.2 (period)  |
             -----------------------------------------------------
			 |
			 | broken
			 v

which is written:

  PROC monitor.2 (VAL INT period, CHAN R.DATA gather?, report!, CHAN BOOL broken!)
    CHAN R.DATA c:
    PAR
      watchdog (period, gather?, c!, broken!)
      monitor (c?, report!)
  :

The question says: "to look out for a delay of period microseconds or more from the last input". This does not imply dividing time into a regular series of time slices (as given by the correct templates in Question 68 (2007)). Instead, we need the incorrect version that calulates the timeout relative to the timing of the last input (as asked by this question). So, the watchdog can be coded:

  PROC watchdog (VAL INT period, CHAN R.DATA gather?, report!, CHAN BOOL broken!)
    WHILE TRUE
      TIMER tim:
      INT timeout:
      SEQ
        tim ? timeout
        timeout := timeout PLUS period
	INT angle, distance:
        ALT
	  gather ? angle; distance              -- data arrived in time
	    report ! angle; distance            -- assume no delay here
	  tim ? AFTER timeout
	    SEQ
	      broken ! TRUE                     -- report supply failure
	      gather ? angle; distance          -- wait for supply to resume
	      report ! angle; distance          -- forward as normal
	      broken ! FALSE                    -- report supply OK again
  :

Strictly speaking, we should follow the golden rule and eliminate needless serialisation in the above response to the timeout:

	  tim ? AFTER timeout
	    SEQ
	      PAR
		broken ! TRUE                   -- report supply failure
	        gather ? angle; distance        -- wait for supply to resume
	      PAR
		report ! angle; distance        -- forward as normal
	        broken ! FALSE                  -- report supply OK again
  :

but marks would not have been lost for not doing that.

Keywords: exams


Question 70 (2007):

Submission reference: IN1456

Regarding the 3b from paper 2006 i have set monitor1 as a subprocess of monitor2. Then the values from the gather are read into the integers angle and value. How can i set the values of a protocol type?Then send it to monitor1 and then monitor1 it outputs on the report channel

Answer 70:

When you say monitor1 in your question, I'm assuming you mean monitor. There is no monitor1 mentioned in this question.

Yes, the hint suggests implementing monitor.2 as a pipeline consisting of a watchdog process and monitor – i.e. monitor is a sub-process of monitor.2.

To read from the gather? channel into integer variables angle and distance:

  gather ? angle; distance

To write to the report! channel from integer variables angle and distance:

  report ! angle; distance

The above will have been necessary for answering part (a) of this question. I don't understand your question: "How can i set the values of a protocol type?". I hope the above answers it.

I also don't understand: "Then send it to monitor1 and then monitor1 it outputs on the report channel"? I would put a watchdog process first in the pipeline inside monitor.2; the output from watchdog being the input of monitor. Hope that helps!

Keywords: exams

Referrers: Question 72 (2007)


Question 69 (2007):

Submission reference: IN1455

Regarding the 2006 past paper question 4b: If the period pass without any incoming data do you want us to constantly send on the output channel false? Also i do know the watchdog process, is it correct if i implement it otherwise? Also do you want us to know every single process implemented during the course? Because watchdog was implemented as an example on a lecture

Answer 69:

I think you must mean question 3b from the 2006 paper?

Assuming you do mean that question, no. The first time no input arrives within period microseconds of the last input, monitor.2 must send TRUE down its broken! channel. If there is never any more input, this process does nothing. But if another input does arrive, this process sends FALSE down its broken! channel and deals with the arrived data as normal.

The watchdog process suggested to help the implementation of monitor.2 is similar to, but not the same as, the one discussed in the course slides (which repeatedly signals on its panic! channel for each period in which data fails to arrive).

Yes, you may implement monitor.2 any way you like – using a watchdog process was only a hint.

No, you don't have to know every single process implemented during the course! You do have to understand enough of the ideas to be able to design and implement whatever processes are needed. If some of these are the same as, or similar to, processes shown in the course, familiarity will help. If you do not understand the ideas well enough, rote learning of the processes presented in the slides will not help.

Keywords: exams

Referrers: Question 72 (2007)


Question 67 (2007):

Submission reference: IN1454

Regarding the 2006 exam question 2a: I have created a protocol which has only a boolean type in it. But the process as I have implemented it, it makes good use of that protocol. Did you expect anything more specific? I didn't find useful or helpful to add more things in it. When the student requests for a drink, it sends a TRUE along the protocol and when the drink is ready, bar sends a TRUE using the protocol to the student.

Answer 67:

You are quite correct. Boolean channels are all that are needed for a student to request a beer and for the bar to supply. And only TRUEs need be sent. Nothing else is needed here.

Keywords: exams

2006

Question 109 (2006):

Submission reference: IN1249

Did this course have a different name before last year? I can't find any other past papers.

Answer 109:

Yes, previously this module was CO516 (parallel and imperative programming), and before that CO502 (parallel programming and formal logic). The material taught has changed over the years, in terms of what and how, so there will undoubtedly be some past questions which you can't obviously answer (which are not C or formal-logic!).

Keywords: exams

2005

Question 10 (2005):

Submission reference: IN733

Hey, just wondering if the bonus question system for the exam will be in place this year again? What I had heard about the system was that if we do all questions in the exam, we would be awarded full credit for the best 3 questions and half credit for the remaining extra question. Thanks for your time.

Answer 10:

It's probably a bit late for this year now, but hopefully you got an answer -- which is no, the same system won't be in place this year; the exam will follow (one of the) the 'normal' styles for CS exams.

Keywords: exams

2004

Question 156 (2004):

Where can I find out about the replicated PARS/SEQ's e.t.c. in the occam book?

What does /\, \/, and <> mean in occam?

Answer 156:

Replicators are introduced in Chapter 5 of the course notes. There's a summary at the end of the on-line Chapter 5 slides (which were added after the notes were printed). They are also explained in the "OCCAM2 CHECKLIST" - the first paper following the slides in the course notes.

The operators listed are respectively: bitwise-AND, bitwise-OR and not-equal. Bitwise-AND is an infix binary operator between two INT values (of the same precision) or between two BYTE values. The result is an INT (or BYTE) whose individual bits are the logical ANDs of the corresponding bits of the operands.

(Sorry ... I'm going off-line now. Questions unanswered are all of the form: "Is the following code a correct answer to Qxxx?" ... which we have always said are not suitable for this forum ... see notes at the top of this page. Good luck tomorrow.)

Keywords: exams


Question 155 (2004):

When's the latest we can submit a Question here to you before the exam?

Answer 155:

Well ... this is a bank holiday! And we have never answered (or had) questions the day before the exam before!! There is no set time limit but I think time is about out ... in any case, you need to get a good night's sleep ...

Keywords: exams


Question 154 (2004):

Just a quick question about the 2003 past paper. In relation to the JCSP question (q6, part b) on the Merge2 Process, should we be reading in from both the channels in Parallel or ALT over them taking input from whatever one is ready?

I would have thought ALTing seemed best, but the channels given to Merge2 aren't ALTing ones - just standard ChannelInputInts which (as I understand it) you cannot ALT over?

Answer 154:

You are right - you cannot ALT over a ChannelInputInt. You need AltingChannelInputInts for ALT guards. But Merge2 should be programmed without ALTing on its input channels and without reading from them in Parallel!

Before entering the loop, read one number from each input channel - in SEQence, any order.

At the start of the loop, the invariant is that we have the latest number from each input channel that has not yet been output. Look for the smaller one and output it, followed by reading another number from the channel that had supplied that smaller number (which re-establishes the loop invariant) - end-of-loop. Exception: if both numbers are equal, output either of them (just the once!), follwed by reading a new number from each channel (again, in SEQence, any order) ... re-establishing the loop invariant ... end-of-loop.

Keywords: exams , jcsp


Question 153 (2004):

In reference to Question 149 (2004) (3 vs. 2 questions); how much of each question do we need to do / how many marks would we need in each section ?

Answer 153:

You should be able to work that out for yourself! -- or write a bit of code to do it (Prolog is good for this sort of thing). The number of marks associated with each part are given, so you could think of a mark and work backwards. The lowest scoring part will be given half-credit, with marks capped at 40 for that section. It's theoretically possible to score more than 40 (and get the mark capped), but unlikely given the amount of time available.

Keywords: exams


Question 152 (2004):

In reference to Question 149 (2004) (highlighters); I meant could we higlight key bits of the exam paper e.g. the bits we need to implement in occam?

Answer 152:

Yes, I think you're allowed to write on the question paper (unless instructions in the exam explicitly say otherwise). I don't think you're allowed to take the question paper away with you, though.

Keywords: exams


Question 151 (2004):

When writing the final class in JCSP, e.g. in the folder Q2 (from the course directory on raptor), the class Q2 has a main() method and does not implement CSProcess. Is this always the case ?

Answer 151:

If it is the "top-level process", then yes; in this case, Q2 is the top-level process (i.e. the overall application/program).

A class should implement CSProcess if something is going to run() it. That might be directly, or indirectly as an embedded process within a Parallel (which is itself, of course, a CSProcess). JCSP processes can be fired up from many sources - e.g. Java applets or applications. In this case, Q2 is a Java application and execution starts from main(...).

You will not be troubled by such considerations in the exam!

Keywords: exams , jcsp


Question 150 (2004):

What did you say about leniency in syntax errors we won't be marked down on ?

Do they include the following: incorrect indentation in occam (once and several times); forgetting the classes to implement in JCSP; and little Java syntax errors.

Answer 150:

There will be a certain amount of leniency in occam indentation, but only up to a point. I.e. missing SEQs will probably incur some small penalty, but not indenting by exactly 2 spaces will not. Small (trivial) errors will probably not incur any penalty either, e.g. forgetting the colon at the end of a declaration, or putting an array-specifier in a slightly wrong place (writing "INT[2] x:" instead of "[2]INT x:", for example).

For JCSP/Java, same thing probably. Forgetting which class to implement is acceptable as long as you're on the right lines. E.g. if you implemented "Process" rather than "CSProcess", or used an "InputChannel" instead of a "ChannelInput". For syntax errors, small ones are acceptable. E.g. writing things like "new Parallel ({a, b, c}).run ();" instead of "new Parallel (new CSProcess[] {a, b, c}).run ();". Missing semi-colons probably acceptable too. Also, confusing occam's ":=" for Java's "=" ... and occam's "=" for Java's "==" will not be penalised.

In general, simple syntax/class-name errors that would be picked up by a compiler will incur no penalty provided the context of your writing gives enough clues that I understand what you meant.

Keywords: exams


Question 149 (2004):

Relating to Question 143 (2004), Three additional questions I have about the exam:

  1. Can we write out occam and diagrams (if we choose to do them) in pencil in case we make mistakes.
  2. Can we take a highlighter to highlight the important bits from your essay styled Question.
  3. How much of each question do we need to answer if we are taking the 3Q easier route ? For example in the 2004 exam, am I corrcet in thinking if we answered just 3a, b, 4a, b and 5a, b we could get a good mark ? At the end of the day is the advised strategy if we are taking this route to start doing as many of the easy Q's that we can, do John Bovey's C and then of we have time come back to occam and JCSP. It would be handy to know roughly how much of 3 Q's we need to do as all that has been said recently is "Do the easy bits" but I just wanted clarification on exactly how much that is.

Answer 149:

  1. Yes; we prefer diagrams to be drawn in pencil rather than pen.
  2. Not sure whether highlighters are allowed, but it's not strictly necessary -- we'll decide which bits of your answer are important when marking :)
  3. If you answered those quetions you mention, then the maximum marks obtainable for each question would be 9, 7 and 3 respectively. The new rubric states that the lowest scoring question (in the case where you answer 3) is given half-credit. That would be question 5 in this case, so the maximum mark you could get is 9+7+1.5 = 18. Out of 40, that's not high (45%). Having a go at some of the other parts to these questions would probably gain extra marks. But.. if you feel that you can answer two of the questions fully, then do that. Only go down the "easy" route if you find yourself struggling with the later parts of some questions, or know that you can't answer these parts.

Keywords: exams

Referrers: Question 152 (2004) , Question 153 (2004)


Question 147 (2004):

Question 4e of 2002 exam looks really tricky, I don't know where to start the diagram from. What will the diagram look like ?

Answer 147:

That's kind of a hard question to answer here -- but would have been exactly the right question to ask in the revision seminars last week! But looking at the question, I'd probably start by drawing a big "box" process, and its three channel-arrays. The question talks about a ring of alternate "multiplex" and "catch" processes, so draw those 8 processes and connect up in a ring. Then it's just wiring.

But here goes ... the following is much easier to draw by hand (or a drawing package) than with this ASCII-art!

                                           | |              |
                                    tap[0] | | tap.out[0]   | in[0]
                                           v ^              v
                                           | |              |
             +-----------------------------|-|--------------|-----------------------------+
             |                             | |              |                             |
             |               r[0]       +-------+  r[1]  +------+     r[2]                |
             |       ,--------->--------| catch |---->---| plex |------->--------.        |
             |       |                  +-------+        +------+                |        |
             |       |                                                           |        |
             |       |                                                           |        |
             |    +------+                                                   +-------+    |  tap[1]
       in[3] |    |      |                                                   |       |--------<---
      -->---------| plex |                                                   | catch |    |
             |    |      |                                                   |       |-------->---
             |    +------+                                                   +-------+    |  tap.out[1]
             |       |                                                           |        |
             |       ^  r[7]                       box                     r[3]  v        |
             |       |                                                           |        |
  tap.out[3] |   +-------+                                                    +------+    |
      --<--------|       |                                                    |      |    |  in[1]
             |   | catch |                                                    | plex |--------<---
      -->--------|       |                                                    |      |    |
     tap[3]  |   +-------+                                                    +------+    |
             |       |                                                           |        |
             |       |                                                           |        |
             |       |       r[6]        +------+ r[5]  +-------+      r[4]      |        |
             |       `---------<---------| plex |---<---| catch |-------<--------'        |
             |                           +------+       +-------+                         |
             |                              |              | |                            |
             +------------------------------|--------------|-|----------------------------+
                                            |              | |
                                            ^              v ^
                                      in[2] |   tap.out[2] | | tap[2]
                                            |              | |
The code is easier:

  PROC box ([n]CHAN OF INT in, tap.out, [n]CHAN OF BOOL tap)
    [2*n]CHAN OF INT ring:
    PAR i = 0 FOR n
      PAR
        catch (tap[i], ring[2*i], ring[(2*i) + 1], tap.out[i])
        multiplex (in[i], ring[(2*i) + 1], ring[(2*(i + 1))\(2*n)])
  :

Note: in the above diagram, the names multiplex and ring were shortened to plex and r, respectively.

Keywords: exams


Question 146 (2004):

Does the new rubric mean that both the occam questions will be code based ? As opposed to the 2004 exam paper where the second question on occam was more knowledged based asking questions about real time systems etc. and not actually requiring more than fragments of code in one instance to be written?

If it is the case that we will see questions such as this, can you give a sample response to the first part of this question:

What extra requirements on real-time systems differentiate them from non-realtime systems.

as I cant seem to find enough on this for 3 marks in the slides or on google. Thanks.

Answer 146:

No, the new rubric does not change the nature of the questions, only the structure of the exam. So you could be asked either (or a mix, in whole or in part).

For real-time systems, the main requirement (generally) is that the system must respond to external events within a given amount of time. This has a variety of implications for programs/systems. Exploring one of these will likely gain you the required marks (using a guideline of 6 minutes for answering the question). E.g. if a "control" process blocks on a channel output indefinitely (say because some external hardware broke down), it might not be able to respond to some other important event until the output completes (which may never happen). How would you go about designing the system so that this doesn't happen ?

Critical for this are tricks like avoiding starvation when servicing data streams from real-time sources -- which we do by `fair'-ALTing -- and the use of overwriting buffers (to discard data that we don't have time to deal with; though we should also record the fact that data *has* been so discarded). See the chapter in the slides on "Managing Hard Real-Time Systems" (chapter 8, I think) and the paper in the course notes with that same name.

The key point: real-time systems differ from non-real-time ones in that their correctness depends not only on the answers they deliver but on the timeliness of that delivery. For example, computing evasive course corrections too late to avoid the crash is not good enough!

Keywords: exams


Question 145 (2004):

In Q3(c) of the exam 2003 I did the following for the watch process:

  PROC watch (CHAN INT in?, out!, CHAN BOOL error!)
  INT count:    -number of consecutive zeros
  SEQ
    count:= 0
    WHILE TRUE
      INT i:
      out ! i
      SEQ
        in ? i
        IF
          i=0
            SEQ
              count := count + 1
              IF
                count = 5
                  SEQ
                    error ! TRUE
                    WHILE i = 0
                      SEQ
                        in ? i
                        out ! i
                    error ! FALSE
                TRUE
                  SKIP
          TRUE
            count := 0

Is this correct? I think it is, but I am not sure if I am outputting to the correct channel...

Answer 145:

These sorts of (code-based) questions are best directed at your seminar leader, but given the closeness of the exam..

You'll see that I've edited your code slightly -- evened out the indentation and separated an IF combined with its first condition. In answer to the question, yes, the code is mostly correct. There are some small things though. Firstly, the first output is in the wrong place -- it should go after the input in the SEQ. I.e.:

    WHILE TRUE
      INT i:
      SEQ
        in ? i
        out ! i
        IF
          ...

The second is that non-zero output after 5 or more zeros doesn't cause "count" to be reset, so if more zeros then come in (say infinitely more), "count" will keep getting incremented until "count := count + 1" overflows (and the last "error" output was FALSE). Not fatal for the exam, but pretty bad news for a nuclear reactor!

Keywords: exams


Question 143 (2004):

Hi, I can't remember from last year, but if we want scrap paper do we get given any if we ask, or is some made available anyway ? Its just I have found I need to do a lot of scribbling before I produce understandable code (for you to mark :)).

Answer 143:

You use the back of the answer book and put a single line through it (in pencil preferably, i.e. a big / across the page). The reasoning being that if you botch the answer, we can look at your rough work to see what the process might have been (and award marks accordingly). Just for the record, please don't use tip-ex, or heavily scribble something out.

Keywords: exams

Referrers: Question 149 (2004)


Question 142 (2004):

If I am stuck on a question in the exam, if I write out the algorithm and say what I intended to code, will I gain any marks ?

Answer 142:

In all likelihood, yes (assuming such an algorithm is correct, or heading that way).

Keywords: exams


Question 140 (2004):

What do you want as the answer to question 3d of 2004 exams? Is TRUE (output on the brake channel) the right answer?

Answer 140:

No. The question asked for the sequence of outputs.

Initially, TRUE is output, since the initial value from the control logic was TRUE and the pedal channel has just delivered a TRUE. That slams on the brakes. The question scenario now syas that wheel-lock happens. This is detected by the detect process, which ourputs that fact to control, which reacts by sending FALSE to combine, which reacts by sending FALSE to the brake, which lifts the brakes.

Hopefully, with the wheels free to turn, they will start spinning again. The detect process detects this, tells control, which waits delay microseconds before outputting TRUE to combine. So long as the driver has kept the brake pedal depressed, nothing further (from the initial TRUE) has been sent down the pedal. We now have two TRUEs in combine and, so, TRUE is output to the brake channel, which re-applies the brake.

If wheel-lock re-occurs, the above sequence repeats. Eventually (and, again hopefully, before a crash), the car has slowed sufficiently for the wheels not to lock when the brakes are applied and the car stops under control.

This is a farily full description of events. Something shorter would have won full marks.

Keywords: exams


Question 135 (2004):

With regards to question 5c of the 2003 paper: In designing the layer.b proc I have come across a problem. I have a replicated PAR and must instantiate the node.b process, however I have no idea what to use for the weight array, all I know is that "each node will be given a different array of weight values" and so cannot assume that I can include this weight array in layer.b's PROC header. Unless of course we are expected to extract each node's array from an array of arrays passed to the layer.b process from some other process, but surely that's a bit far fetched? and would also imply that any nodes above the node will have the same array. Any help would be greatly appreciated.

Answer 135:

Passing down indices into an array of arrays given as a parameter would be quite appropriate. It's very little code in practice. "Unless of course we are expected to extract each node's array from an array of arrays passed to the layer.b process ..." -- yes, and it's not far fetched! Suppose:

  PROC node.b (VAL INT id, threshold, VAL [n]INT weight,
	       CHAN OF BOOL up.in, down.out, right.in, left.out)
    ...
  :

Then:

  PROC layer.b (VAL INT threshold, VAL [n][n]INT weight,
		[n]CHAN OF BOOL in, out)
    [n]CHAN OF BOOL ring:
    PAR i = 0 FOR n
      node.b (i, threshold, weight[i],
	      in[i], out[i], ring [(i+1)\n], ring [i])
  :

That's all!

Keywords: exams


Question 134 (2004):

RE the Rubric. In a previous Q you said the rubric was: (cite Question 125 (2004)). Which matches what you said in the lectures, but on the CS web page:

Parallel and Imperative Programming
There are SIX questions, THREE in Section A and THREE in Section B. Candidates should answer ANY number of questions from Section A. Full marks for this section will be obtained for correct answers to TWO questions. If THREE questions are answered, the weakest answer will be given half-credit. Marks for this section will be capped at 40. From Section B candidates should answer question 4 and EITHER question 5 or 6.

Could you please explain the format a bit clearer as you told us we would have to answer all the C Q's and either 2 Occam or 1 Occam and 1 JCSP or both occams and 1 JCSP, but I just want clarification that section A will be Occam and JCSP as previously section B was JCSP and Occam?

Answer 134:

Nowhere in Question 125 (2004) does it say anything about needing to answer all the C questions, quite the opposite in fact. Yes, section A is occam and JCSP, section B is C -- it must be this way around given the relative marks for each section (section A carries twice as many marks as section B, reflecting the fact that twice as much time was spent teaching occam/JCSP compared with C).

Keywords: exams


Question 133 (2004):

I've become stuck on question (3b) (specifically producing the "rate" part) of the 2003 paper. I can't think how to make the rate process without creating a cell process, a process that links the cells and the rate process itself. But this can't be correct for only 3.5 marks. I was wondering if you could point me in the right direction.

Answer 133:

You mean part (3c) presumably. The question hints towards the answer in this case, "The rate process maintains a buffer of the last 10 values it received, initialised to zeros". There are two ways of doing buffers in occam, serial and parallel. Both of these have been discussed in the seminars when we looked at Q6 (names+marks). The parallel approach involves some pipeline of cells, but programming in the required functionality will be messy (although not impossible). The serial approach involves arrays, and for this "rate" process, an array would seem to be the right choice.

Keywords: exams


Question 132 (2004):

In reference to Question 130 (2004), what module code was this module (or the bits in it) called and are those past papers available for extra practice ?

Answer 132:

Previous to being CO516, it was CO502. Any available past exam papers are on the web.

Keywords: exams


Question 129 (2004):

Could you please tell us the examinable chapters and papers in the notes ?

Answer 129:

See the answer to Question 105 (2004).

Keywords: exams


Question 128 (2004):

How should question 4 (d) from the 2003 past exam paper be answered?

Answer 128:

Not sure I can give much help here; it says "briefly explain the differences in behaviour between par.loop and loop.par.". So you should do that .. As mentioned in Question 126 (2004), you can mail your seminar leader with answers to get feedback.

Keywords: exams


Question 126 (2004):

Is there any chance we could have model answers to past papers put up, or alternatively can we email you our attempts ?

Answer 126:

Model answers to past questions are not available -- see the answer to Question 42 (2002). But yes, you may email us (specifically your seminar leader) with your attempts to get feedback.

Keywords: exams

Referrers: Question 128 (2004)


Question 125 (2004):

Could you explain the exam rubrics again ? Am I correct in thinking the questions will be the same format as in previous years (i.e. starts off with defining PROC headings and then gets us to programm more complex code) and the only difference is that we could answer all 3 and get the best marks of 2 of them?

Answer 125:

This information is provisional, subject to approval of the rubric by the external examiner.

The Co516 paper has two parts: Section A (on the occam/JCSP material presented by Peter Welch) and Section B (on the C material presented by John Bovey). Section A carries 40 marks and Section B carries 20. There are 2 hours for the paper, so an equal time balance-per-mark between the Sections gives you 80 minutes for Section A and 40 minutes for B. The rough rule is 2 minutes per mark.

The rubric (provsional, see above) for Section A is:

             Answer ANY number of questions from this section.
 Full marks for this section will be obtained for correct answers to TWO questions.
   If THREE questions are answered, the weakest will be given half-credit. 
              Marks for this section will be capped at 40.

Note: there are 3 questions in this section and each question carries 20 marks. The questions have similar styles to those asked in previous years. [Not all questions have the format of defining some PROC headers, bodies and network code!]

My (phw) advice on strategy for this section depends on how well you are on top of the material when the exam comes along. If you are on top, choose just two questions and answer them fully. The questions are designed to take about 40 minutes to be read and answered -- and you have around 80 minutes (see above). If you find yourself with any time left at the end of the examination (having checked through *all* your answers against the questions carefully, making sure you haven't mis-read anything in any question), have a go at the Section A question you haven't answered. On the other hane, if you are not on top of the material but, at least, know the basics, answer the early (easier) parts of all three Section A questions. You get full credit for the best two and half-credit for the third, which might be enough to pass. [Note: two of the questions in this Section require knowledge of occam and one requires JCSP. So, if you are skipping the JCSP material, you will have no choice of question here.]

The rubric (provsional, see above) for Section B is:

               Answer the first question from this section.
         Answer just one of the last two questions in this section.

Note: there are 3 questions in this section and each question carries 10 marks, making a maximum of 20 marks for this section. The first question tests basic knowledge. You must then answer only *one* of the last two questions, which test the ability to apply your basic knowledge to new problems. You may *not* answer both of the last two questions - you must choose.

Keywords: exams

Referrers: Question 134 (2004) , Question 134 (2004)


Question 105 (2004):

Just out of curiosity, which chapter will we be examined on ? Will we be expected to know about the Transputer and the different processes (talked about in chapter 2) ?

Answer 105:

You will be examined on the material presented in the lectures. For the occam part of this module, we omitted chapter 1, (most of) chapter 3, chapter 7 and chapter 9. That leaves chapters 2, 4, 5, 6, 8, 10 and some of 3 (chapter 3 has little technical content). But the papers in the course notes are also part of the examinable material. The "Checklist", "occam Approach", "Hard Real-Time" and "GOTO" papers all write up material presented through the slides. The "Emulating", "Graceful" and "Paradigms" papers explore ideas we didn't present, but a study of them will broaden your understanding and confidence. [BTW, the Transputer was not mentioned in chapter 2 and, no, you will not be examined on the Transputer!]

For the rest of this term, we will be studying concurrency in Java through the JCSP packages, which provide the same model you have learnt through occam. The JCSP materials are also, of course, examinable.

All this will be apparent to those attending lectures. If you miss any, it is your responsibility to find out what you missed ...

Keywords: exams

Referrers: Question 129 (2004)


Question 93 (2004):

In the occam exam I am presuming we'll have to write some code ? Will the marking scheme be lenient-ish in marking since occam has strict rules on indenting ? Also will we be getting some practice in this later on in the terminal sessions ?

Answer 93:

You may have to write some code in the exam (and based on past exams it's probably quite likely). The marking will be lenient in the sense that we won't be expecting exactly 2 spaces, but the indents and outdents (where they occur) should be obvious. If you do write some code, then realise the indentation is wrong, don't re-write it (that'll take too long). Instead just draw suitable annotations to show the indentation change.

For practice, we will be looking at some past exam questions in the seminars -- terminal sessions finished long ago for this course!

Keywords: exams , indentation

2003

Question 125 (2003):

Looking at the 2002 question paper and I'm lost by question 4(e) I don't understand what it is asking..

Answer 125:

The question describes the internal structure of the `box' process, then asks you to draw a diagram and write the code for it. Writing the code will be much easier once you have a network-diagram in front of you..

One possible implementation of the `box' process is:

    PROC box ([n]CHAN INT in?, tap.out!, [n]CHAN BOOL tap?)
      [n]CHAN INT c, d:
      PAR i = 0 FOR n
        PAR
          multiplex (in[i]?, c[(i+(n-1)) \ n]?, d[i]!)
          catch (tap[i]?, d[i]?, c[i]!, tap.out[i]!)
    :

Keywords: exams


Question 124 (2003):

In the 2002 exam paper I'm stuck on question 3(b) ... I just have no idea how to tackle the changing of the rate of flow in this question :(

Answer 124:

This is a fairly complex question and needs to be read carefully. Once things are up and running, the `controller.1' process passes values between its `in' and `out' channels at a rate determined by values communicated on `speed'. At the very least, the code for this will require a timer, along with timeout (absolute time of next `tick') and interval (time between `tick's) values, e.g.:

    TIMER tim:
    INT timeout, interval:

The question specifies that `controller.1' should wait for input on `speed' before doing anything:

    BYTE b:
    SEQ
      speed ? b
      WHILE b = 0
        speed ? b          -- wait for a non-zero `speed'

      -- setup interval and timeout
      interval := 255000000 / ((INT b) * max.rate)
      tim ? timeout
      timeout := timeout PLUS interval

After this, `interval' contains the time in micro-seconds between outputs and `timeout' has the absolute time of the first `tick' (that will cause output).

The body of this process will need to be an `ALT' (or `PRI ALT') -- there are two events that require waiting for: a new `speed' signal, or the output timeout. Trying to include the `in' channel in the ALT will complicate things -- that input should be controlled by the timeout. The main body of this process would therefore have the form:

    WHILE TRUE
      PRI ALT
        tim ? AFTER timeout
          ...  handle timeout (input/output)
        speed ? b
          ...  handle new speed

Handling a new communication on `speed' should be similar to the initialisation code, remembering to update the timeout as well. For example:

    --{{{  handle new speed
    SEQ
      WHILE b = 0
        in ? b
      interval := 255000000 / ((INT b) * max.rate)
      tim ? timeout
      timeout := timeout PLUS interval
    --}}}

The arithmetic both here and in the earlier initialisation is taken from the question paper. Handling the timeout is slightly trickier -- if there is no value to be read from `in', the `controller.1' process should repeat the last value it did input. The test for channel-input-ready can be done using a `PRI ALT' with a SKIP guard (polling). To keep the last data-value between iterations of the process, that needs to be declared outside the loop (along with the `TIMER' etc. would be OK) -- and probably a good idea to initialise it too.

The body of the `handle timeout' process could be:

    --{{{  handle timeout
    SEQ
      PRI ALT
        in ? data
          SKIP
        TRUE & SKIP
          error ! 0                 -- signal error
      out ! data

      timeout := timeout PLUS interval
    --}}}

Keywords: exams


Question 123 (2003):

How should we answer the question which asks us to explain how a buffered channel of capacity 100 can be implemented without using an ALT. Does this meen that the buffer size is 100 or we have 100 channels. I assumed the latter seeing as it mentioned the ALT but don't really know how to answer it.

Answer 123:

The actual solution is to use a pipeline of (parallel) processes. See the answers to Question 65 (2000) and Question 41 (2002).

Keywords: exams , buffered-channel


Question 121 (2003):

There is a question that asks what rule can be followed in order to ensure deadlock avoidance and I can't seem to find anything about deadlock except on the philosophers example. Can you shed some light on this ?

Answer 121:

There are two design rules that guarantee deadlock freedom: client-server and IO-PAR/IO-SEQ. These are in the course notes (discussed in detail in one of the papers). You have not been taught these this year, however, so no need to revise this! But.. it is useful background reading. It's worth noting that the dining philosophers doesn't remove the deadlock by either of these methods. That deadlock is solved by preventing the deadlock condition occuring in the first place, which is slightly less intuitive than client-server or IO-PAR/IO-SEQ, and a lot harder to prove.

Keywords: deadlock , exams


Question 120 (2003):

In the question from the 2000 exam paper below what would be the correct answer to what's written below. I know it's because of race hazards it is illegal, but I can't think of a way to rewrite the code.

Consider the following (illegal) outline of an occam system:

    BOOL running:
    SEQ
      running := TRUE
      PAR
        WHILE running
          ... do operation A
        SEQ
          ... do operation B
          running := FALSE

what was the the system trying to acheive? modify the code so it acheives it legally

Answer 120:

The solution is to use a channel and communication. The 2nd parallel process is easy -- change the assignment to a channel output. Modifying the 1st parallel process is less obvious. Essentially it's a ``check if still `running', and if so, do operation A''. The `check' needs to be modified, but it can't be a simple input. Instead, an `ALT' is required, to select between `communication from the other process' and `nothing'. In code:

    BOOL running:
    SEQ
      running := TRUE

      CHAN BOOL c:
      PAR
        WHILE running
          PRI ALT
            c ? running
              SKIP
            TRUE & SKIP
              ... do operation A

        SEQ
          ... do operation B
          c ! FALSE

This is polling, that isn't a very pleasant thing to do. Depending on what `operation A' is, it might be possible to move the ALT on `c' inside.

Keywords: race-hazard , exams


Question 77 (2003):

Hi! I a find occam very difficult and was wondering if there is going to be an overview lecture or two soon? There is so much info to take in that I don't feel I have a proper grasp of it yet. I find working out whether the system will deadlock or not difficult to determine, and also when to use parallel and when to use sequential. Whenever I program something in occam I have countless errors even though I think I have computed it correctly. This worries me as in the exam we obviously will not have the benefit of a compiler. Can I suggest that some optional terminal sessions are set up almost as drop-ins, as a lot of people in my seminar group are finding it easy? Thanks.

Answer 77:

The remainder of my part of this course consists of the real-time material (chapter 8 of the slides and the paper: "Managing Hard Real-Time ...") and JCSP (which presents a Java class library giving exactly the same occam/CSP concurrency model). The JCSP material will review the fundamental ideas that have already been presented for occam. There are only a few such ideas and they are simple. But they have to be mastered.

Deadlock analysis is not particularly simple but, so long as you are fluent in the concurrency mechanisms of the occam/CSP model, it becomes not unreasonable. If you think it's hard in occam, try it for the standard Java threads model!

If you don't understand when to use PAR and when to use SEQ, then you have not understood anything about the concurrency model and you have to do something about it. Have you not been attending the weekly seminar groups where all the ideas are rehearsed as you discuss the assignments? We provide these seminar groups precisely to enable you to raise any issues - especially fundamental technical principles - with your seminar leader and group.

You should not be getting "countless errors" when compiling occam code. We provided 4 (or 5) weeks of terminal classes last term specifically to assist you in mastering the basic syntax and structure of the language and in understanding the compiler error messages. If you are now getting countless error messages, you do not have such basic mastery ... and how can you have got by the first three assessment exercises?

Basic syntax and structure is given on slides 4-22, 4-26 .. 4-30, 4-33 .. 4-35, 5-27 and 5-36. Some extra stuff is on 10-5 .. 10-6, 10-10 .. 10-22. Of course, smeantics is also discussed there. Everything is spelt out in words in the "occam2 Checklist" paper (17 pages). And there are examples everywhere else. But it all must be read and re-read and discussed and re-read. And you must draw/design lots and lots of process icons and network diagrams and write lots and lots of code.

We already provide - through the weekly seminars - far more help for this course than you will find available for many others. I do not think magic assitance at terminal classes will have much educational benefit at this stage in the course. If completely stuck in understanding why your program won't compile, ask a friend, your seminar leader or me (phw) directly. Only puzzle over the first few error messages from any compiler - fix those and then re-compile. View the occam compiler expecially as your friend - it just won't let you do anything silly and prevents you from making a great range of more subtle mistakes. It ensures you know about the scope of declarations and the scope of programming structures. Learn the very simple rules, let your programs compile and they will work ...

Finally, when marking exam scripts, minor errors in syntax are ignored - so long as the overall logic and structure can be seen. You are not being assessed in the exam on trivial mistakes that the compiler would put you right upon if presented with your code. Indented layout, however, needs to be (rouhgly) right because that shows up the logical structures. But indenting hand-written code costs no time and should be automatic.

Keywords: overview , exams

2002

Question 46 (2002):

How strict will you be with indentation when marking our exams?

Answer 46:

Indenting handwritten code is no burden. I need to be able to see structure in your code and indentation makes that plain. So, badly indented code that is hard to follow definitely means fewer marks - the same as for anything that is hard to comprehend. Of course, I'm not going to be counting spaces and making sure everything lines up exactly - it just needs to line up roughly and be neat.

Having said that, I'm not going to penalise minor syntax errors - e.g. getting the layout of an IF a bit wrong, some missing colons, some missing SEQs etc.. Also, don't be afraid to cross things out or insert missed out lines by writing them on the script, drawing an approx. circle around it and drawing an arrow from that circle to where the enclosed code should be inserted ... just don't let it get too scrappy! If you don't have room to write missed-out code on the page it needs to be inserted, draw an 'A' (or 'B', 'C', etc.) in a circle with an arrow to the insert point - write the missing code on another page and label it with the 'A' (or 'B', 'C', etc.) again in a circle. It just needs to be obvious what you intend.

A powerful scheme is to use the "fold" notation shown in some of the course slides - e.g.

  SEQ
    ...  initial bit
    ...  second bit
    WHILE running
      ALT
        ...  deal with in?
        ...  deal with kill?

That shows the overall structure. Then, an in any order, you could write out the "folded" bits - e.g.

  "initial bit"

    out.string ("Hello world ...", 0, screen)
    count := 0
    SEQ i = 0 FOR SIZE x
      x[i] := 42
    running := TRUE

and:

  "deal with kill?"

    BOOL any:
    kill ? any
      running := FALSE

or whatever. This is just a more pre-planned way of doing the trick with the forward references via the letter-in-bubbles above.

Summary: I need to see that you have mastered the concepts sufficiently to apply them to express logic necessary to design and implement solutions to specific problems. I'm not demanding perfect syntax ... that's trivial to get right with the aid of a compiler. I'm looking for clear structure and semantics - the simpler the better ... remember Ockham's Razor ...

Keywords: exams


Question 43 (2002):

Is it ok to write code in pencil in the exam?

Answer 43:

Yes - so long as it is visible.

Keywords: exams


Question 42 (2002):

Are the answers to previous years exams available to us?

Answer 42:

This question seems to have been asked about most courses. I'm afraid the answer here is still the same - no.

The seminar groups spent most of Lent term working through past exam questions ... where something much more valuable than the answers was made available. If you didn't attend, find people who did and ask for help. Explaining things to others will help them revise as well.

Keywords: exams , model-answers

Referrers: Question 126 (2004)


Question 41 (2002):

In past exam paper 1998 question 3(b), it says that without writing an ALT construct, explain how a buffered channel with a capacity of 100 can be implemented. I'm interested in how can an ALT construct implement a buffered channel,please? Thank you.

Answer 41:

You stick a buffer process in the channel - see slides 6-11 to 6-13 and slides 6-17 to 6-17. The answer to the question asked in the paper, of course, is given by slide 5-7 (or 6-17).

Keywords: exams , buffered-channel

Referrers: Question 123 (2003)


Question 40 (2002):

How much of the JCSP stuff is examinable?

Answer 40:

Look at the slides on the Co516 web page, under the link:

  JCSP course slides (3/02/2003)

All of them contain information that is relevant. However, before slide 62, this information is mainly revision of ideas. They do include some formal CSP notation, but this is for information only and not examinable. The important stuff is from slide 62 onwards, which presents the JCSP process structure (slide 65), the core API and examples of its use. Slides 125 through 132 (on graphics and GUIs) are not examinable. Neither is anything on the JCSP Networking Edition (slide 144), accessible through the main JCSP web page.

Keywords: exams , jcsp


Question 32 (2002):

[Answering two questions here ...]

I was wondering what topics in the course text are not examinable?

and ...

For the JCSP stuff we're covring now, do we only need the course slides, jcsp.ppt? The JCSP home page seems to have slides for jcsp, jcsp.net, csp-java-model etc..

Answer 32:

Only material covered in the lectures or the seminars is examinable. This excludes slides 7-22 through 7-42, all of the chapter 9 slides and slides 10-24 to the end. Also, I don't expect you to remember details of transputer architecture (slides 7-3 through 7-7) - that was given just to present ideas of hardware description. All the printed papers in the course booklet (except the ones on GOTO and Emulating Digital Logic) were covered - but those missed out make useful background reading. The High-Level Paradigms paper was only partly covered - sections 4.5 and 4.6, But the rest is highly educational!

On JCSP, we are only going to work through the slides in jcsp.ppt. The other stuff should be of interest - but is definitely not examinable. Maybe, some may be interested in final year project work in this area though ...

Keywords: exams , jcsp

2000

Question 93 (2000):

Can you tell me how the CO516 exam is split between the parallel and imperative components of the course? In other words, is section A on C programming and section B on occam?

Answer 93:

Yes. Section A has 2 questions on C, while section B has 4 questions on occam (+ a little JCSP).

Keywords: exams

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:27 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.