October 2024
Intermediate to advanced
272 pages
6h 54m
English
There used to be two good friends, Alice and Bob. Once, they had a bitter argument over different dialects of Occam. Chuck, who happened to be their mutual friend and a go-between, told Alice that Bob would send her a text message, but only after she texted him first. Then he told Bob that Alice would send him a text message, but only after he texted her first. The two never spoke to each other again.
The following example translates the drama into Occam:
| | PROC deadlock () |
| | VAL hello IS 'H': |
| | CHAN OF BYTE alice.to.bob, bob.to.alice: |
| | PAR |
| | BYTE text.msg: |
| | SEQ -- Alice: text me, then I text you |
| | bob.to.alice ? text.msg |
| | alice.to.bob ! hello |
| | |
| | BYTE text.msg: |
| | SEQ -- ... |
Read now
Unlock full access