Task

Spawn a new process which can run simultaneously with, and independently of, the original parent process.




int Key, Process;
[Key:= SharedMem(4);    \allocate 4 bytes of memory common to both processes
Process:= Fork(1);      \start one child process
case Process of
  0:  [Lock(Key);  Text(0, "Rosetta");  CrLf(0);  Unlock(Key)]; \parent process
  1:  [Lock(Key);  Text(0, "Code");     CrLf(0);  Unlock(Key)]  \child process
other [Lock(Key);  Text(0, "Error");    CrLf(0);  Unlock(Key)];
Join(Process);          \wait for child process to finish
]