# NPTEL Introduction to Operating Systems Week 6 Assignment Answers 2024

By Sanket

## NPTEL Introduction to Operating Systems Week 6 Assignment Answers 2024

1. Which of the following are atomic statements?

i) if(count==0)

• i is atomic , ii is non-atomic
• i is non-atomic , ii is non-atomic
• i is non-atomic , ii is atomic
• Both are atomic
`Answer :- For Answers Click Here `

2. When a process exiting a critical section calls wakeup() , all the contending processes wake up at once. This is called ____________and____________ can be used to solve this problem. (Choose the option such that the first word is the answer for the first blank, and the second word is for the second blank)

• Thundering herd problem, Process queue
• Lost wakeup, Process queue
• Thundering herd, Semaphores
• Lost wakeup, Semaphores
`Answer :- For Answers Click Here `

3. State True/False.

Petersonâ€™s solution is a synchronization mechanism that works for a maximum of two processes.

• True
• False
`Answer :- For Answers Click Here `

4. If the value of a counting semaphore s = 6, then the maximum number of requests for the critical section before it blocks is _______________ ?

• 0
• 2
• 4
• 6
`Answer :- `

5. Which of the following is not an atomic primitive?

• Test and Set
• Test-test and set
• Cmp and swap
• None of the above
`Answer :- `

6. Consider the notation nP and mV to indicate n down operations and m up operations on a semaphore respectively. In a certain application, the initial value of a counting semaphore s is 15. The following operations were completed on the semaphore in the given order 5P, 8P, 4V, 7P, 6V, 3P, 4V. The new value of the counting semaphore is _______________ ?

`Answer :- For Answers Click Here `

7. Consider the notation nP and mV to indicate n down operations and m up operations on a semaphore respectively. For an application using a counting semaphore, the following sequence of operations is obtained: 6P, 3V, 5P, 4V, 8P. The value of the semaphore at the end of these operations is -4.

`Answer :- `

8. If the current value of a counting semaphore s = -2. I.e. The number of processes that can enter the critical section is 2.

• True
• False
`Answer :- `

9. Atomic operations like test and set ensure that

• They are executed in a single cycle.
• They can be executed in multiple cycles,no other memory memory instruction is executed while this instruction is executing.
• They can be executed in multiple cycles,but no other memory instruction to the same variable is executed while this instruction is executing.
• No other instructions execute in the background while this instruction is being executed.
`Answer :- `

10. When the return value of fork() is zero , it indicates the current process is:

• Parent process
• Child process
• Forking failed
`Answer :- For Answers Click Here `