XML

kent logo

CO538 Anonymous Questions and Answers

This page lists the various questions and answers. 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.

We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course.

When asking questions, please do not simply paste in your code and ask what is wrong with it, as these types of question are hard to answer in a public forum (resulting in either no answer, or an answer which will only be of use to the person asking the question). In many cases, a question about code can be formulated in general terms. For example, if you have an `IF' block that results in an `incorrect indentation' error, you might ask, ``what is the correct syntax for an occam `if' statement ?''. Questions of this form are easier to answer, and are meaningful to all.

Questions that are not suitable for these public pages (i.e. those that contain assignment-specific code), should be mailed to your seminar-leader.


Question 1:

When will we find out about the terminal-sessions/seminars ?

Answer 1:

Group lists will be posted in the computing octagon this week; classes start next week.

Keywords: classes


Question 2:

The terminal sessions -- do they run from week 2 and how long do they run for ? i.e. are they a one off session or do they run throught the term?

Answer 2:

The terminal sessions will run for a few weeks (typically 3), i.e. weeks 2 to 4 inclusive, then seminars start after that. The terminal sessions are to give you some hands-on experience/help with editing, compiling and running occam programs on raptor. As with the seminars, attendance is compulsary.

You should read the setup information (and do as much of it as possible) before your first terminal session.

Keywords: classes


Question 3:

Are we expected to have installed the occam compiler and setup our PCs on the Public PCs, or just on our home PCs ? And will the terminal session be used to set up our public PCs or just show us how to use the system?

Answer 3:

The first question sounds slightly confused. Occam-related work is done largely on raptor, accessed via eXceed either from a public PC or your study bedroom PC. See the X setup information on how to do this. If you're off-campus, read the above information via chain.kent.ac.uk.

You should do this before the first terminal-session. Also, you should follow through the instructions on this page, again before the first session. If you have problems setting this up, help will be available in the first session. At a minimum you should make sure you have a raptor account and can login to it (using putty/ssh), even if you can't get eXceed to work properly.

If you want to run the occam system on your own PC, you'll need Linux. See this page for information. An experimental windows/cygwin version of KRoC is available. For this you'll need to install and setup cygwin, with the gcc compiler; then download and install the latest pre-release KRoC, in the cygwin environment. Note: this is only if you want to compile/run occam programs on your own PC. For the purposes of the course, KRoC on raptor works fine -- even from off-campus (login via putty/ssh).

Referrers: Question 4 (2004)


Question 4:

(following on from Question 3 (2004))

What I was trying to ask is: do the Public PCs, to which we have logins, already have the software and occam compilers etc. installed, or is this something we'll be doing in the terminal session. Or is it expected that we would have logged into our machines on the Uni network and installed it before the class?

Answer 4:

Hopefully the previous answer covered these points. You do not install the occam compiler on the Public PCs. The occam system, that we expect you to use, is installed on raptor -- a Sun Enterprise server hiding in the machine room. However, to access raptor (in a useful and visually pleasant way) you need to use eXceed, which is installed on the Public PCs, or you can download and install on your own PC. However, getting eXceed to login to raptor from off-campus is relatively non-trivial -- so you can use another login tool (e.g. putty).

As mentioned before, before the first class we expect you to have read and done the instructions given on this page. Help will be available if you run into problems. At the very least you should make sure you can login to raptor (either using eXceed or putty), as this will verify that you do indeed have a raptor account. If not, visit computing service reception.


Question 5:

You said to go into the following folder on raptor:

    /usr/local/courses/co516/setup 

and I click on the setup file and it comes up asking which application I want to run it in. Any suggestions?

Answer 5:

You need to run the setup file ... and that must be done from the raptor command-line. E.g.:

    bash$ /usr/local/courses/co516/setup

Double clicking on the file from a UNIX desktop environment ought to have worked (e.g. Gnome), but presumably not.

Keywords: setup


Question 6:

Once we've logged in to Raptor via eXceed, is the idea that we create 3 new folders: 1 called `co516', with subfolders `examples' and `exercises' and are we meant to drag or copy the work from Raptor and put this in our own directory?

Answer 6:

Essentially yes, but, this is what the `setup' script (i.e. `/usr/local/courses/co516/setup') does for you when run. Note that these folders should be on raptor, not on your bodiam (Z:) or other PC drive -- the files must be accessible from raptor -- if you want to copy them yourself; but running the setup script is easier :-).

Keywords: setup


Question 7:

Is the Question 1 brief located anywhere in the course notes ? I can't seem to find a reference to the rules we need to implement regarding PROCs A & B.

Answer 7:

Yes, it's the last page of the notes (that seems to be loose in many cases). If lost, a copy of the exercises is on raptor: /usr/local/courses/co516/etc/ex-sheet.{ps,pdf}.

The information was also given, rather quickly, at the end of last Friday's (15/10/2004) lecture -- see course slides 4-17 through 4-20. We spent half of this morning's (19/10/2004) lecture also going through these -- and spelling out how to structure your occam program to implement this system. You could not have been at either lecture. Further help and explanation is being given in your terminal classes. If you miss lectures, it is your resposibility to find you what you missed. Same for the classes (except they are compulsory!).

Keywords: exercises


Question 8:

Is it a possible for you to give a brief example of the kind of output you are expecting from q1 ? I.e. it says tabulated, but I have also been told string form. Many thanks.

Answer 8:

Not sure what you mean by "string form"; but ultimately you have to output BYTEs from the program, usually formed into strings (see the various example "hello world" programs for an idea of this).

The "demo" program is a good idea of what is expected for output, at least in layout. You can view the output a screenful at a time with:

    raptor$ ./demo | more

(where `|' is the pipe symbol, shift-backslash on UK keyboards). The key lines in `demo.occ' for tabulation are 15 and 16.

Keywords: q1


Question 9:

I get this error when I try to run my occam program (it compiles fine without errors):

    KROC: Range error / STOP executed (signal 4)
    KROC: Fatal error code 1, core dumped
    Abort (core dumped)

What does this mean?

Answer 9:

Have a look at the answer to Question 103 (2003).

Keywords: stop


Question 10:

On the `q1' program after we have output the 3 intergers and then their average, are we to output the next 3 + 1 on a new line and if so how do you have a newline character in occam ?

Answer 10:

Yes, the numbers output should be tabulated, as seen in the `demo' program. Finding out how to produce a new-line should be pretty simple (look at the code for `layout.max.chans' in `demo.occ', lines 15 and 16). A slightly quicker way is just to output a newline character to the screen channel:

    screen ! '*n'

(note that asterisk is the escape character in occam, similar to backslash in C and Java)

Keywords: q1


Question 11:

I keep getting the output:

    KROC: Program Deadlocked (no processes to run) but I can't figure out why.

I've looked at the keyword list and the Q&As associated with the word deadlock but still haven't come up with anything.

    [code snipped]

Answer 11:

Posting questions like this to the anonymous Q+As is not generally advised -- the answer is only likely to be meaningful to the person that asked the question. Please direct such questions to your seminar supervisor.

But looking at your code: you have your `B' process outputting integers, that is not wrong as such, but a little more complex than was expected for this assessment. The system deadlocks when `B' tries to output, since the corresponding inputting process is executing in SEQuence with it. Moving the instantiation of `B' in the `q1' process will fix one problem, but leave some others.

For this assessment, it's easier to have the `B' process do the output to a `BYTE' channel that `q1' simply connects to its own `screen' channel.

Keywords: q1


Question 12:

In the course Assesments page it says we have an assignment:

ASSESS 2 - A2 AN INTERACTIVE NETWORK (Q4)

has this been set already?

Answer 12:

In theory, yes. Along with the other exercises that are listed as being set in Week 3. In practice you won't be able to start these until you have sufficient knowledge of occam programming. Seminars start next week, and Q4 is probably on the cards for discussion (probably with Q2 and Q3 before it).

Note, however, that the deadlines for Q4, Q6 and Q7 are weeks 8, 12 and 17 respectively.

Some information on this was posted to the newsgroups: `ukc.cs.cs2' and `ukc.ee.year3', that you should read. In particular the post of Fri 15th Oct 2004 titled "Co516 assessments". This post is archived on raptor:

    /usr/local/courses/co516/news/news-0.txt

Keywords: assessments


Question 13:

What exactly do we need to submit for Q1, e.g. just the code for PROCs `a', `b', `q1'. Are any special network diagrams required ?

How do we submit Q1, e.g. print out of code, hand in to CAS with coversheet, or email, or both ?

Answer 13:

These questions have almost certainly been answered in the lectures and classes... You should submit a print-out of your `q1.occ' file, with a cover-sheet, to CAS. Coversheets are available in the CO516 pigeonhole.

No special network diagrams are required, because there should already be one in the `q1.occ' file -- showing the three processes and their wiring.

Please also remember to print your code in a monospaced font. To print from raptor, you can use a command like:

    a2ps -1 -L100 -o - q1.occ | psdouble | lp -d times

Replacing `times' with a different printer if needed.

Keywords: q1


Question 14:

When I compile the program, I get output saying:

    Warning-oc-q1.occ(63)- Parameter error is not used
    Warning-oc-q1.occ(63)- Parameter keyboard is not used
    KROC octran Version 1.0 for sparc-sun-solaris2.5.1

I think this is saying that basically I've defined the variables `error' and `keyboard' but not used them. Was this an error in that we should not have defined `error' and `keyboard' or do we just leave them in and if so what was the point of defining these two variables ?

Does this mean I can't run the program ?

Answer 14:

Those messages are warnings, not errors. So, there's nothing to stop you running the program -- it compiled successfully. Your screen-dump also included some GTK messages generated by gvim, but these are totally unrelated (except that gvim was started in that terminal, hence its error messages end up there).

As a point of concept, `keyboard' and `error' are not variables. They are channels and the distinction is important. You should not remove these from the top-level PROC definition, which should always have the form:

    PROC thing (CHAN OF BYTE keyboard, screen, error)

The name (`thing') is unimportant -- what makes it the `top-level' process is the fact it's defined last in the source file. If you're using KRoC/Linux or KRoC/cygwin, removing some or all of these top-level channel parameters is safe, but not on the KRoC installed on raptor.

Keywords: q1


Question 15:

What is `demo.occ' supposed to do and how is it meant to help us with `q1.occ' ?

Answer 15:

The `demo' process network outputs 4 columns of numbers from various example process networks. You should be able to understand the code that sets up the network (and draw the diagram for it).

The output from `demo' is similar to the output required from `q1'. In `demo.occ', this is done by the `layout.max.chans' process. The interesting bits are its use of `out.int' and `out.string' for actually outputting numbers and strings on a BYTE channel.

Keywords: q1 , demo


Question 16:

Can you tell me how we're meant to test `q1.occ', i.e. what inputs are necessary and what the outputs should be ?

I've tried inputting numbers into the console but they come up with errors and I'm not exactly sure how we are meant to test this thing.

Answer 16:

You're not supposed to be giving `q1' any input! The network diagram given in `q1.occ' shows that the `screen' channel only is connected -- the `keyboard' and `error' channels should not be used.

To get an idea of the output it should produce, run the model solution on raptor:

    /usr/local/courses/co516/answers/a1

The spacing in your output may be different, but the numbers should be the same.

Keywords: q1

Referrers: Question 18 (2004) , Question 22 (2004)


Question 17:

What is a a monospaced font?

Answer 17:

One where the characters are all the same size (e.g. `courier' or `fixed'). Contrast with proportionally-spaced fonts, where the size of individual characters varies (e.g. `helvetica' or `times'). Program code is generally better presented in a monospaced font. Particularly for occam, where indentation matters.


Question 18:

Your reply to Question 16 (2004) was that we can't test out code by typing in numbers. How are we meant to test it then or how are we meant to know if what we've done is correct ?

Also if we don't finish `q2' by tomorrow, is it possible for us to email our programmes to you direct ?

Answer 18:

Are you asking about Q1 or Q2 here ? In fact, both Q1 and Q2 should just produce output spontaneously. You can see if you're generating the correct output by comparing with the output from the model solution. Q1 should generate the sequence: 0, f(0), g(f(0)), f(g(f(0))), ..., as produced by the `A' process, displayed in groups of 3 numbers with their average.

The input for Q2 (differentiate) is the `numbers' process, as explained in `q2.occ'. But Q2 is not assessed, so you don't need to submit it. If you want someone to check it over, email your class supervisor, or bring along to the seminar/terminal-session.

Keywords: q1


Question 19:

Could you please clairfy the correct syntax for indentation in occam. When do you indent a line by two spaces relative to the line above it and when do you use a `:' ?

Answer 19:

The best guides for indentation in occam are existing examples and the "occam2 checklist" (that can be found in the course notes, and on raptor in `/usr/local/courses/co516/etc/' -- `checklist.txt' and `checklist.ps').

The `:' (colon) in occam is used to mark the end of a declaration, and the point at which whatever declared comes into scope. Thus you find it on the end of variable/channel declarations and at the end of `PROC' (and other) definitions. The rule for variable scoping in occam is: a variable is in scope for the process following its declaration. And declarations can be made before any process. For example:

    INT x:
    SEQ
      x := 42
      out.int (x, 0, scr!)
      scr ! '*n'

Here, `x' is in scope for the whole of the `SEQ' process. Contrast with a broken version of the above:

    SEQ
      INT x:
      x := 42
      out.int (x, 0, scr!)
      scr ! '*n'

In this, `x' is declared just before the assignment-process (`x := 42'), so is in scope there, but not in the procedure call to `out.int' -- so the compiler will likely report an error (unless there is another `x' in scope).

Keywords: indentation , variable-scope

Referrers: Question 54 (2004)


Question 20:

Is the only way to test our implementation of `q1', to implement `q2' as well ?

Answer 20:

Nope, `q1' and `q2' are unrelated. To test `q1', just run it. It should produce the same output as the model answer.

Referrers: Question 22 (2004) , Question 24 (2004)

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