Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions