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 priority
2008 |
Submission reference: IN1705
How can we implement a structured priority alternation of processes? For example, I have 3 processes A, B and C. I want A to have the first priority, then B and finally C. Can we nest the PRI ALT constructs to achieve this, as follows:
PRI ALT PRI ALT x ? any A() y ? any B() z ? any C()
?
Priorities given by a PRI ALT relate to the guards rather than the processes they are defending. So, it does not make sense to say you "want A to have the first priority". It would make sense to say you "want channel x to have the first priority", etc.
The code fragment you give does give priority first to channel x, then to channel y and, then, to z. But there is no need to nest the PRI ALTs! A single PRI ALT can have any number of guarded processes. So:
PRI ALT x ? any A() y ? any B() z ? any C()
does the same job. See slides 124 to the end of the choice slides for the rules about nesting ALTs.
Keywords: priority
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. |