Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 - Programming Problems. (60pts) - Zip your answer sheet for Problem 1 and problem 2 source codes (e.g.,.c files) together and upload it

image text in transcribed
Problem 2 - Programming Problems. (60pts) - Zip your answer sheet for Problem 1 and problem 2 source codes (e.g.,.c files) together and upload it to the Blackboard. 2.1 Demonstrate fork() system calls. Description: In Unix/Linux, when we create a process, we first fork from the parent process, then execute a new program in the child process. Your goal is to write a program to: 1. fork() a new child process. (The fork system call creates a new process by duplicating the calling process) 2. After the call to fork, the child process and the parent process run concurrently. 3. Need to use 'child_pid' to hold the process 10 of the child process. If 'child_pid' equal to 0 , the current process is the child process, thus your code need to print out "I am process \#" followd by its process 10 . 4. If 'child_pid" is not equal to 0 , return to the parent process, and print out "l am the parent of process \#" followed by the process 10 of the child process on the screen. 5. In the end of your code, should return to 0 to have a termination of your program

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

Step: 3

blur-text-image

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

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions

Question

Classify delivery styles by type.

Answered: 1 week ago