Fork Call System Call – Operating System

Fork Call System Call – Operating System

Question 1 UGC NET June-2020      
Assuming that the system call fork () never fails, consider the following C programs P1 and P2 executed on a UNIX/ Linux system.

Statement I: P1 displays “Happy” 8 times.
Statement II: P2 displays “Happy” 12 times.
In the light of the above statements, choose the correct answer from the options given below.
A – Both Statement I and Statement II are true
B – Both Statement I and Statement II are false
C – Statement I is correct but Statement II is false
D – Statement I is incorrect but Statement II is true

Show Answer With Best Explanation

Answer- C 
Explanation:
Fork is the primary method of process creation on Unix-like operating systems. Fork system call is used for creating a new process, which is called child process, which runs concurrently with the process that makes the fork() call (parent process).When fork() is called, parent & child process is run concurrently & complete program is executed for both parent process & child process.
For P1: 

For P2: skip it for now.


error: Content is protected !!
Open chat
1
Hi,how Can We Help You ?
Exit mobile version