# Process Selection

Next: Synchronization, Previous: The Par Loop, Index: Index

When writing code in SPMD style, you can select a certain process via the process selection statement
proc [var/value]
{
body
};
In this case, the process who's PID equals that of the variable or value will execute the body, whereas all other process will ignore the body. It should be noted that, if there does not already exist a process who's PID equals the value, then it will be created along with all preciding processes not already created. For instance, if there is only one process until proc 3 then three additional processes will be created by that statement - one with PID 1, one with PID 2 and one with PID 3.

## Examples

proc 1
{
print["I am process 1\n"];
};
print["I am process 0 or 1\n"];
In the example, both processes (1 and 0) will execute the last line, whereas only process 1 will display the message "I am process 1"
Last Modified: August 2008