Search

Answers to Linux Quiz on semaphores

Answers to Quiz on linux Semaphores

1. Race condition occur when
Ans. There is uncontrolled access to shared data

2. The code that is surrounded by a semaphore is termed as
Ans. Critical section

3. To use a semphore as a mutex, semaphore needs to be initalized to the value of
Ans. 1

4.Which of the following will declare and initialize a mutex
Ans. DECLARE_MUTEX

5. The value of the mutex when it is locked by a process is
Ans. 0

6.To create a semaphore which will attempt to get the lock only once, we can use the function

Ans. down_trylock()
7. The functions down and down_interruptible work in similar fashion

Ans. False

8. The function call to release a semaphore is
Ans. up

9. A reader writer semaphore allows
Ans. Multiple readers or only one writer

10. Sending a signal from one thread to other regarding completion of a task/job can be done optimally using
Ans. Completion


Follow by Email