Question: Please do this task correctly do not copy from other chegg answers Thank you Task 2: Passing Environment Variables from Parent Process to

"Please do this task correctly "

"do not copy from other chegg answers "

Thank you

"Please do this task correctly " "do not copy from other chegg

Task 2: Passing Environment Variables from Parent Process to Child Process In this task, we study how a child process gets its environment variables from its parent. In Unix, fork ( ) creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate of the calling process, referred to as the parent; however, several things are not inherited by the child (please see the manual of fork () by typing the following command: man fork). In this task, we would like to know whether the parent's environment variables are inherited by the child process or not. - Step 1. Please compile and run the following program, and describe your observation. The program can be found in the Labsetup folder; it can be compiled using gcc myprintenv. c, which will generate a binary called a.out. Let's run it and save the output into a file using a. out > file. - Step 2. Now comment out the printenv ( ) statement in the child process case (Line 1), and uncomment the printenv() statement in the parent process case (Line 2). Compile and run the code again, and describe your observation. Save the output in another file. - Step 3. Compare the difference of these two files using the diff command. Please draw your conclusion

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!