Assuming that the system call fork () never fails, consider the following C programs P1 and P2 executed on a UNIX / Linux system: /*P1*/ Int main() { fork (): fork () ; fork () ; Printf(“Happy\n”); } /*P2*/ Int main() { fork (); Printf(“Happy\n”); fork () Printf(“Happy\n”); fork () ; Printf(“Happy\n”); } 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
Statement I is correct but Statement II is false
Each successful fork doubles the number of processes reaching the next statement. P1 has 8 processes at its only print statement. In usual line-buffered terminal execution, P2 prints 2 + 4 + 8 = 14 times, not 12. Thus Statement I is true and Statement II is false.
A computer system has 7 tape drives. There are ‘n’ processes competing for them. Each process may need 2 tape drives. What is the maximum value of ‘n’ for which the system is guaranteed to be deadlock free?
Match List I with List II
List I | List II | ||
System calls | Description | ||
A. | fork() | I. | Sends a signal from one process to another process |
B. | exec() | II. | Indicates termination of the current process |
C. | kill() | III. | Loads the specified program in the memory |
D. | exit() | IV. | Creates a child process |
Choose the correct answer from the options given below :
________ system call creates new process in Unix.
Identify the circumstances under which pre-emptive CPU scheduling is used:
(a) A process switches from Running state to Ready state
(b) A process switches from Waiting state to Ready state
(c) A process completes its execution
(d) A process switches from Ready to Waiting state
Choose the correct option: