Example PRAM Program
0. LoadProcid 0
1. ReadAcc (0),1
2. JNeg 5, 1
3. Load 1, 1
4. Jump 6
5. Load 0, 1
6. StoreAcc (0), 1
7. Halt
- Assume we have `M`-processors and our global memory is also `M`-integers.
- The idea is this code replaces each nonnegative integer in the input with 1 and each negative integer with 0.
- So if the input was (-1,0, 10, 5, -50) the output will be (0, 1, 1, 1, 0).
- Since it can be quite painful to fully spec out machine code for our algorithms we tend to describe our algorithms at a slightly higher level, while remaining careful that any of the things we are saying a PRAM could do, could in principle be written in code as above.