Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE READ THE QUEstion PROPERLY AND THEN ANSWER //Type and run the code to get the values of a, b and process id. Briefly write

PLEASE READ THE QUEstion PROPERLY AND THEN ANSWER

image text in transcribed

//Type and run the code to get the values of a, b and process id. Briefly write your interpretation (in a text file) on working of the code to explain how your code arrive at the values you printed out. Note: run your program multiple times and see whether there are any changes in the order of execution before writing your report.

Part 2 Consider the parent process as P. The program consists of fork() system call statements placed at different points in the code to create new processes Q and R. The program also shows three variables: a, b, and pid with the print out of these variables occurring from various processes. Show the values of pid, a, and b printed by the processes P, Q, and R. //parent P int a 10, b-25, fq-o, fr o i iorkt) if(fq -0)//Child successfully forked // fork a child - call it Process Q a-a+b print values of a, b, and process_id fr fork()//fork another child - call it Process R if(frl o) b-b+20 print walue i, b, and process id else a-(a*b)+30 print values of a, b, and process_id else b-a+b-5; print values of a, b, and process_id

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

The T - account approach:

Answered: 1 week ago