return to UNIX

Parent process communicates with its N children (N - program's parameter) using two (shared) pipes.

nr_children := N.
while (nr_children ≥ 1)
{
Each child (i) randomizes some number V(i) and sends it to the parent process.
Parent process computes: k := sum (V(i)) % (nr_children - 1), then checks for k-th process PID and sends that number to all its children.
The child with that PID prints its ID and then exits.
nr_children--.
}

This task will be graded by Marek Kozłowski please submit your solutions to /home2/samba/kozlowskim/unix/ folder.

return to UNIX