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:

Test question for 2005.

Answer 1:

Test answer for 2005.

Keywords: test


Question 2:

Submission reference: IN57

testing CO631 anonymous question

Answer 2:

Test automated response :)


Question 3:

Submission reference: IN108

Test question for 2006 ;)

Answer 3:

In the 2005/2006 academic year :)


Question 4:

Submission reference: IN218

Hi, what's the drawback of occam-pi and JCSP compared to a threading models of C++/Java? Surely, if it was that good to use everyone would be using it? How come JCSP isn't endorsed by Sun?

Answer 4:

Nothing is wrong/broken with the occam-pi/JCSP models, in fact there's a whole lot right with them (and a whole lot wrong with threads+locks). For example, check out the comments on threading from Sun's own web pages. Particular quotes are:

‘‘If you can get away with it, avoid using threads. Threads can be difficult to use, and they make programs harder to debug.’’

and:

‘‘Component developers do not have to have an in-depth understanding of threads programming: toolkits in which all components must fully support multithreaded access, can be difficult to extend, particularly for developers who are not expert at threads programming.’’

and:

‘‘It is our basic belief that extreme caution is warranted when designing and building multi-threaded applications … use of threads can be very deceptive … in almost all cases they make debugging, testing, and maintenance vastly more difficult and sometimes impossible. Neither the training, experience, or actual practices of most programmers, nor the tools we have to help us, are designed to cope with the non-determinism … this is particularly true in Java … we urge you to think twice about using threads in cases where they are not absolutely necessary …’’

Next point: technical merit in no way guarantees success -- technical crudge in no way guarantees failure. There are zillions of examples of this. If you don't believe us, go try building concurrent systems directly using the Java threads model. It's only fit for super-heroes (as the above quotes indicate). Somehow, everyone ‘‘gets by’’, but don't bet your life on the results. Sun didn't want to frighten their customers with something too different, no matter the technical argument.

There are probably a few reasons for the industrial non-take-up (so far) of the CSP model. First, you can't safely embed these sorts of primitives in C++ or Java (well, with very clever escape and other semantic analysis, maybe). Note how strict occam-pi is compared with C++, C or Java. Secondly, and perhaps more relevant, is that programmers have been using threads+locks for N years, and are reluctant to change. This is the "frighten" argument just mentioned.

Some individuals/groups are beginning to realise that threads+locks get insanely complicated in big systems (and systems only get bigger). Microsoft have reported that around 85% of corrected bugs in Windows are down to errors arising from misuse of concurrency. So, when your terminal locks up and you have to reboot either the application or the whole operating system, guess what's probably the cause! Microsoft is even building a research operating-system (called Singularity) which follows very closely the occam-pi/CSP model we are presenting to you. In the department, we are also researching an operating-system (RMoX) with the same goals of Singularity -- i.e. reliability -- but with significantly lower overheads, :-) …

Finally, in just about every programming-language or theory textbook I've picked up, there's usually the sentence ‘‘concurrency is a nuisance’’ (or thereabouts). This has led the world to thinking that concurrency must necessarily be hard -- something to resort to when all else fails and the system somehow has to be made more responsive. This does not help at all when we say to you (repeatedly): ‘‘concurrency is easy’’. We hope to show you this in this module -- but you have to have the right mental model. The CSP model of bits of hardware (processes) connected together by wires (channels) -- and structure (i.e. networks of these things within networks of these things) -- is that very simple model. It's easy to visualise, ‘‘feel’’ and, therefore, reason about.

Industry is slowly beginning to change towards something that isn't threads-and-locks (e.g. monitors in Java). There appears to be increasing interest in the CSP model of parallel programming (and a few others, e.g. pi-calculus, join-calculus, ambient-calculus, … but all process algebras from the same stable).

Thanks for the question, :).


Question 5:

Submission reference: IN521

I understand that occam is more of a research language, however apart from the occam webserver (which is developed in house), have any external companies made any large freely available programs with it? It would be good to see how it compares to other similar programs written in C.

Also does occam/kroc/transterpreter currently support/utilize the dual-core-ness of modern cpu's on the market today? Thanks.

Answer 5:

As for freely available occam, there isn't much -- mostly what we've done here at Kent and what others have done at other institutions in the last couple of years. There's an old archive of free occam software (from the Transputer days) on the WoTUG IPC Archive, but bear in mind that much of that is for real Transputers (and would take some fiddling to get it working in KRoC). The KRoC release has only been freely available for about the last 10 years (about 7 for Linux/i386, 2 for Windows). More people are getting interested in occam-pi, but slowly. On the non-free side, people are still using occam and Transputers in certain applications, mainly military (who have a strong need for formally verified hardware and software).

KRoC does not support SMP on the Intel platform yet. There is a multi-processor Sparc8 version lurking around (probably never released though). An SMP implementation wouldn't be too hard, but has only become sensible since about Linux 2.6.10 (and I've not quite had the time to hack it up yet ;-)).


Question 6:

Submission reference: IN629

Hi, I was just wondering what kind of delays should we put in between the philosophers thinking and eating. If we set them to eat for longer than think, then you'll see the security flag up as a 5th tries to sit, however if you set them to think for longer then you'll very rarely see the security go up, if at all. What should the time delays roughly be?

Answer 6:

The delays should be random. See the other questions under the random keyword for details on how to use it.

However, you are right that the eating times should be a bit longer, mostly, than the thinking times ... to get a chance to see a hungry philosopher who is blocked by security.. Suggest making eating times random between 6 and 15 seconds, with the thinking times random between 2 and 8 seconds. If the action still seems a bit slow, reduce by a factor of 10 - experiment!

Keywords: q7 , random


Question 7:

Submission reference: IN630

Hi, My code runs fine on the transterpreter, but trying to use KRoC on raptor with the same code generates a bunch of errors. Why is this?

Answer 7:

The version of KRoC installed on raptor is a bit old. Solutions to this would include using the Transterpreter (e.g. via JEdit), or finding a Linux install with KRoC -- such as the VM that has been provided, compsoc's "compsoc1" machine, or the department's "gonzo" box (you can mail cs-syshelp to request a login, say it's for CO631).


Question 8:

Submission reference: IN638

With the random number generator are you supposed to create a new process to create the random number or does it go within an existing process. If this is the case do you have to have 2 random generators for thinking and eating. If the only way to get better marks for the assessment is to use this, why didn't we have it explained in lectures?...Thank you for your help

Answer 8:

The "random" thing is just a FUNCTION, so you can call it inline or wrap it up in a process; I prefer inline calls. This may not be needed for the philosophers assessment set this year, however, there's plenty of documentation on it available, it's not hard to use, and it'll produce a more convincing animation. Just because it's not required doesn't mean that you can't do/use it!

Keywords: q7


Question 9:

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 9:

No. Last year's rubric was deemed too complicated (although no student or staff had any problem with it!).

All rubrics for this year's papers are published here. For Co631:

    There are FOUR questions.
    Candidates should answer THREE questions,
    the ONE question from Section A and TWO from Section B.

If your answer all THREE from Section B, one of the answers will not count. Sorry -- you must follow the rubric.

Keywords: q7


Question 10:

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

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.