Create Presentation
Download Presentation

Download Presentation

x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork();

x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork();

194 Views

Download Presentation
Download Presentation
## x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork();

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**PID 100**x = 20 y = 30 count = 1 PID 100 x = 150 y = 30 count = 1 PID 100 x = 150 y = 50 count = 1 PID 100 x = 150 y = 50 count = 2 PID 100 x = 250 y = 50 count = 2 PID 100 x = 250 y = 70 count = 2 PID 100 x = 250 y = 70 count = 3 PID 150 x = 0 y = 30 count = 1 x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork(); y = y + 20; } else { x = fork(); y = y + 35; } count = count + 1; } PID 250 x = 0 y = 50 count = 2**PID 100**x = 20 y = 30 count = 1 PID 100 x = 150 y = 30 count = 1 PID 100 x = 150 y = 50 count = 1 PID 100 x = 150 y = 50 count = 2 PID 100 x = 250 y = 50 count = 2 PID 100 x = 250 y = 70 count = 2 PID 100 x = 250 y = 70 count = 3 PID 150 x = 0 y = 30 count = 1 PID 150 x = 0 y = 50 count = 1 PID 150 x = 0 y = 50 count = 2 PID 150 x = 350 y = 50 count = 2 PID 150 x = 350 y = 85 count = 2 PID 150 x = 350 y = 85 count = 3 PID 350 x = 0 y = 50 count = 2 x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork(); y = y + 20; } else { x = fork(); y = y + 35; } count = count + 1; } PID 250 x = 0 y = 50 count = 2**PID 100**x = 250 y = 50 count = 2 PID 100 x = 20 y = 30 count = 1 PID 100 x = 150 y = 30 count = 1 PID 100 x = 150 y = 50 count = 1 PID 100 x = 150 y = 50 count = 2 PID 100 x = 250 y = 70 count = 2 PID 100 x = 250 y = 70 count = 3 PID 150 x = 0 y = 50 count = 2 PID 150 x = 0 y = 50 count = 1 PID 150 x = 350 y = 50 count = 2 PID 150 x = 350 y = 85 count = 3 PID 150 x = 0 y = 30 count = 1 PID 150 x = 350 y = 85 count = 2 PID 350 x = 0 y = 85 count = 3 PID 350 x = 0 y = 50 count = 2 PID 350 x = 0 y = 85 count = 2 x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork(); y = y + 20; } else { x = fork(); y = y + 35; } count = count + 1; } PID 250 x = 0 y = 50 count = 2**PID 100**x = 250 y = 70 count = 2 PID 100 x = 20 y = 30 count = 1 PID 100 x = 150 y = 30 count = 1 PID 100 x = 150 y = 50 count = 1 PID 100 x = 150 y = 50 count = 2 PID 100 x = 250 y = 50 count = 2 PID 100 x = 250 y = 70 count = 3 PID 150 x = 350 y = 85 count = 3 PID 150 x = 350 y = 85 count = 2 PID 150 x = 350 y = 50 count = 2 PID 150 x = 0 y = 50 count = 2 PID 150 x = 0 y = 50 count = 1 PID 150 x = 0 y = 30 count = 1 PID 350 x = 0 y = 50 count = 2 PID 350 x = 0 y = 85 count = 3 PID 350 x = 0 y = 85 count = 2 x = 20; y = 30; count = 1; while (count < 3) { if ( x != 0) { x = fork(); y = y + 20; } else { x = fork(); y = y + 35; } count = count + 1; } PID 250 x = 0 y = 50 count = 2 PID 250 x = 0 y = 70 count = 2 PID 250 x = 0 y = 70 count = 3