Exercise
Explore and practice key UNIX process APIs including fork, exec, wait, and pipe through hands-on coding exercises. Understand how process creation, execution, synchronization, and communication are managed at the OS level by experimenting with variable changes across parent and child processes, file descriptor sharing, process synchronization, and data flow between processes.
We'll cover the following...
In this exercise, you are to gain some familiarity with the process management APIs about which you just read. Don’t worry – it’s even more fun than it sounds! You’ll, in general, be much better off if you find as much time as you can to write some code, so why not start now?
Questions
-
Write a program that calls
fork(). Before callingfork(), have the main process access a variable (e.g.,x) and set its value to something (e.g.,100...