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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.