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 modulo

2000

Question 88 (2000):

Hi - I am confused about this declaration on slide 6-62

    fork (left[i], right[(i+1)\5])

What does the "\5" do and why is it not just "5" as in "left[i]"?

Answer 88:

The "\5" means "modulo 5" - i.e. the integer remainder when you divide the LHS operand, (i+1) by 5.

Your second question makes no sense - did you mean "i" as in "left[i]"? If so, look at the network diagram on slide 6-61. Each philosopher connects to left and right channels with the same index number. The forks connect to left and right channels with different indices. In most, the right channel index is one more than the left one. The exception is the fork in the top-left corner, whose right channel index is zero and has to be zero to complete the circle. The simplest way to express this is the line quoted above.

Keywords: modulo

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