[1] (1.1) child: XX parent: DD (1.2) child: XDXD parent: XDXD (1.3) child: XX parent: DD (1.4) child: XDXD parent: XDXD (1.5) child: XDXD parent: BLANK [2] (2.1) B C (2.2) B D F (2.3) UNPREDICTABLE, see output below: F @E\x85\xd9ڠ\xff\xff B [3] Possible answers: 1) signal() may restart sem_wait(), leading to unbounded wait 2) There is a race condition: SIGALRM may be delivered after we call alarm() but before sem_wait() 3) SIGALRM may have been blocked before calling sem_wait_with_timeout() 4) sem_wait_with_timeout() would cancel an existing alarm, if there was one 5) A pending alarm could arrive after signal() but before alarm(timeout). Depending on the system, this could reset the SIGALRM handler. 6) sem_wait_with_timeout() replaces the existing SIGALRM disposition 7) sem_wait() could be interrupted by a different signal, which causes a race condition with alarm(0). This could incorrectly set errno to ETIMEDOUT. [4] (4.1) False (4.2) False (4.3) True (4.4) True (4.5) False