Question: programming language: c Write a program that calls fork(). Before calling fork(), have the main process access a variable (e.g., x) and set its value
programming language: c
Write a program that calls fork(). Before calling fork(), have the main process access a variable (e.g., x) and set its value to some- thing (e.g., 100). What value is the variable in the child process? What happens to the variable when both the child and parent change the value of x?
Write a program that opens a file (with the open() system call) and then calls fork() to create a new process. Can both the child and parent access the file descriptor returned by open()? What happens when they are writing to the file concurrently, i.e., at the same time?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
