0

I've started reading "The Art of Multiprocessor Programming". Seems like a great book. It claims to have examples written in Java, and it really seems this way in the beginning, to the level that they can be copied and run as-is. However, quite quickly I start to see features which I had no idea were in Java. I guess they're not and the book simply uses fancy Java-like pseudocode, but it still doesn't hurt to verify.

I'm talking about things like:

  1. Using the existential quantifier in a while condition, e.g.

while(\exists k != me) (level[k] >= i && victim[i] == me)

(replace \exists with the actual mathematical sign; recall that Haskell has similar things).

  1. Using tuples and lexicographical ordering built-in to the syntax, e.g.

(label[k], k) << (label[i], i)

Which compares the left component and if needed, the right component.

As far as I know this is pseudocode and not Java, but I'm hardly familiar with this language.

4

1 に答える 1

0

Java ではありません。詳しくは確認しませんでしたが、たとえば本のウェブサイト02~Chapter_02.zip/ch02/Mutex/src/mutex/Bakery.javaからは、「実際の」Java で表現された最初のコード フラグメントの元となったプログラムのようです。

于 2012-08-17T12:12:57.807 に答える