Assuming fork() never fails, consider: P1: int main() { fork(); fork(); fork(); printf("Happy\n"); } and P2: int main() { fork(); printf("Happy\n"); fork(); fork(); printf("Happy\n"); }. Statement I: P1 displays "Happy" 8 times. Statement II: P2 displays "Happy" 12 times.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. Statement I is correct but Statement II is false
Explanation
P1: three forks make 2³ = 8 processes, each printing once (8). P2: after one fork, 2 processes print (2); after two more forks, 8 processes print (8): 10 in total, not 12.
More System Software and Operating System questions
- If T is the capacity of a track in bytes, and S is the capacity of each surface in bytes, then (T, S)= _____
- What is the capacity of the disk, in bytes?
- Given below are two statements: Statement I: The disk has a total number of 2000 cylinders. Statement II: 51200 bytes is not a valid block…
- If the disk platters rotate at 5400 rpm (revolutions per minute), then approximately what is the maximum rotational delay?
- If one track of data can be transferred per revolution, then what is the data transfer rate?
- A counting semaphore is initialized to 8. 3 wait ( ) operations and 4 signal () operations are applied. Find the current value of the semap…