Fork rule #3

Fork rule #3: After a successful fork, both the parent and child process execute code in parallel.

At first glance, this rule looks pretty much the same as the first rule. But no, what's being stressed here is parallelism. The parent's and child's execution paths run in parallel with each other.

You might wonder how on a single (uni) processor system, this can be? Well, that's right: a fundamental attribute of a modern processor is that exactly one machine instruction can run at any given point in time. So, if we're on a uniprocessor box, it just means that the processes will be time-slicing (or timesharing) on the CPU. So, it's pseudo-parallel; however, the speed of a modern CPU being what it is, a human user will perceive the ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.