### Introduction To Operating Systems NPTEL Week 6 Assignment

### These are solution for Introduction To Operating Systems NPTEL Week 6 Assignment

Course Name: Introduction To Operating Systems

Q1) Consider the following code, comprising of a swap 1 function which is atomic.
a. Mutual exclusion
b. Progress
c. Bounded wait
d. The code snippet solves the synchronization problem

Answer: The code snippet solves the synchronization problem

Q2) In the bakery algorithm for synchronization, if two process have the same token, then the process with lower process number enters the critical section
a. True
b. False

These are solution for Introduction To Operating Systems NPTEL Week 6 Assignment

Q3) Peterson’s solution is a synchronization mechanism works for maximum of processes.

Q4) If the value of a counting semaphore s = 5, then the maximum number of requests for the critical section before it blocks is ________ ?

Q5) Context switch cannot happen while a process executing critical section.
a. True
b. False

These are solution for Introduction To Operating Systems NPTEL Week 6 Assignment

Q6) Consider a program, which spawns 10 threads to find out the sum of all elements in a shared array of 100.Each thread i, takes elements A[i] to A[(10*)-1] and computes a local sun and eventually adds Isum[i] to a shared variable tot sum. Which of the following needs to be placed inside a critical section ?
a. Reading array values
b. Adding to tot_sum
c. Both of the above
d. None of the above

Answer: c. Both of the above

Q7) 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.
a. Thundering herd problem, Process queue
b. Lost wakeup,Process queue
c. Thundering herd, Semaphores
d. Lost wakeup,Semaphores

Answer: c. Thundering herd, Semaphores

These are solution for Introduction To Operating Systems NPTEL Week 6 Assignment

Q8) In a certain application, the initial value of a counting semaphore s is 20. The following operations were completed on the semaphore in the given order 5P, 20P, 2V, 15P, 5V, 10P, 1V. The new value of counting semaphore is?

Q9) Consider the notation nP and mQ to indicate n operations and m up operations on a semaph respectively. For an application using a counti 5 semaphore, the following sequence of c is obtained : 5P, 2V, 10P, 5V, 4P. The value of the semaphore at the end of these operations is -7. What is the initial value of the semaphore?

These are solution for Introduction To Operating Systems NPTEL Week 6 Assignment

Q10) If the value of a current value of a counting semaphore s = -2, what does this imply?
a. The number of processes that can enter the critical section is 2
b. The number of processes blocked from entering the critical section is 2
c. Total number of processes that can critical section and remains in blocked state is 2
d. None of the above

Answer: b. The number of processes blocked from entering the critical section is 2

These are solution for Introduction To Operating Systems NPTEL Week 6 Assignment

All weeks of Introduction To Operating Systems: https://progies.in/answers/nptel/introduction-to-operating-systems

More NPTEL Solutions: https://progies.in/answers/nptel

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first.

### Problem Solving Through Programming In C NPTEL Assignment 9