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 deadlock

2003

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 44 (2003):

Additional to Q40, I havn't actually started using `layout.max.chans' yet, because none of my deltas will work. Currently I've got numbers outputting into the delta I gave which outputs one channel into an output module which just outputs whatever ints it gets onto the screen straight away and the other output going to nowhere. If I remove the delta i get the output i expected, but with the delta in between I get no output. The only thing that can possibly be wrong is the delta. Any more ideas?

Answer 44:

If you leave the second output of the delta unconnected, the delta will get blocked when it tries to output. If you want to discard the data, connect it to an INT style black-hole:

    PROC int.black.hole (CHAN OF INT in)
      WHILE TRUE
        INT v:
        in ? v
    :

Keywords: q4 , deadlock


Question 3 (2003):

I seem to have some problems when I run q1.occ and q2.occ. They both compile but when i run them I get:

    Program deadlock: no process to run.

What am I doing wrong ?

Answer 3:

This generally means that your program deadlocked before anything useful happened. A common error is mis-construction of the top-level process, using `SEQ' instead of `PAR'.

If you have access to KRoC on a Linux system, compile the program with the `-d' flag (debugging). When the system deadlocks, it will report the location (in the source file(s)) of deadlocked processes, e.g.:

linux$ kroc -d q1.occ -lcourse
kroc: Selecting post-mortem debugging
Warning-oc-q1.occ(40)- Parameter error is not used
Warning-oc-q1.occ(40)- Parameter keyboard is not used

linux$ ./q1
KRoC: Deadlock:

  Instruction "OUTWORD"
    in PROC "A"
    in file "q1.occ"
    near line 29

In this case, the system deadlocked with the `A' PROC trying to perform an output (line 29 in this particular q1.occ). Note that this will not work with the version of KRoC on raptor. It will, however, work on gonzo.

Keywords: q2 , deadlock

2002

Question 14 (2002):

In q4 you say 'q' should be dealt with by putting the system into deadlock. Can't we use the command STOP instead?

Answer 14:

Well ... you can, but it's not very nice. Any process executing a STOP - in the current versions of KRoC - causes the whole system to stop in a rather ungraceful way. On the Solaris version, it even causes a core dump! Later versions of KRoC will offer an option so that only the process executing a STOP will stop (i.e. freeze, which is subtly different from terminate) - leaving the rest of the system running. This is what is supposed to heppen.

So, getting your process to respond to 'q' with a STOP is allowed - you will not lose marks for this solution. For a better solution see Question 12 (2002).

Keywords: q4 , deadlock

2001

Question 13 (2001):

From Question 31 (2000), it says:

Getting the monitor to trigger a deadlock (in response to a `q') is easy and will earn full marks (for this part).

Would we get full marks if we implement a livelock ... or do we have to trigger a deadlock?

Answer 13:

Forcing a livelock is a bad idea - your program keeps on running! Forcing a deadlock will terminate your program.

Keywords: deadlock , q4

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