Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Concurrent-computing/XPL0/concurrent-computing.xpl0
Normal file
10
Task/Concurrent-computing/XPL0/concurrent-computing.xpl0
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
int Key, Process;
|
||||
[Key:= SharedMem(4); \allocate 4 bytes of memory common to all processes
|
||||
Process:= Fork(2); \start 2 child processes
|
||||
case Process of
|
||||
0: [Lock(Key); Text(0, "Enjoy"); CrLf(0); Unlock(Key)]; \parent process
|
||||
1: [Lock(Key); Text(0, "Rosetta"); CrLf(0); Unlock(Key)]; \child process
|
||||
2: [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 all child processes to finish
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue