Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Draw a process tree for the following code segment. c1= 0; c2= 0; c1= fork(); /*

ID: 3693941 • Letter: D

Question

Draw a process tree for the following code segment.

c1= 0;

c2= 0;

c1= fork(); /* fork number 1 */

if(c2 > 0)

c2 = fork(); /* fork number 2 */

fork(); /* fork number 3 */

if (c1 >0)

c2= fork(); /* fork number 4 */

2.

Modify the following program so that

when the user presses Ctrl-C (SIGINT: 2) while the program is running, it will print out ‘You cannot kill me!” and

when the user presses Ctrl- (SIGQUIT:3) while the program is running, it will ignore it.

Note: signal(signum, functionname)

3.

In UNIX, a process opens a file and then executes fork() system call to spawn a child process. Can the child process access the same file that is opened by its parent? Why?

Explanation / Answer

in each FORK() function it will decrease the number of child nodes by decreasing one fork() function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote