Reference no: EM133440307
Question
1. Which of the following statements are true for pthread_cond_wait() and pthread_cond_signal()?
A. When a thread is awaken up by pthread_cond_signal(), it will acquire the lock right away.
B. When pthread_cond_wait is called, the thread will release the acquired lock right away and then be put into sleep.
C. When a thread is awaken up by pthread_cond_signalit will not acquire the lock right away.
D. When pthread_cond_wait is called, the thread will not release the acquired lock right away and then be put into sleep.
2. In the file access example near the end of the lecture, which of the following statements are true?
A. 'pthread_cond_broadcast(can be replaced with 'pthread_cond_signal()' without any other change .
B. 'while' cannot be replaced with 'ifwithout any other change.
C. 'pthread_cond_broadcast cannot be replaced with ' pthread_cond_signal0 without any other change.
D. 'while' can be replaced with if without any other change.