Introduction To Operating Systems NPTEL Week 6 Assignment
Session: JULY-DEC 2023
Course Name: Introduction to Operating Systems
Course Link: Click Here
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Q1. Consider the following statements:
i) if(count==0)
ii) add %eax,%ebx
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: i is non-atomic , ii is atomic
Q2. Which of the following condition could occur due to lack of synchronization?
Inconsistency
Loss of data
Deadlock
All of these
Answer: All of these
Q3. Return value of xchg instruction is_____________
Old value
New value
1 if operation succeeds and 0 if operation fails
None of the above
Answer: Old value
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Q4. By using intel hardware xchg instruction, ensures that
The critical section is deadlock free
Solution is starvation free
Process enters CS in FIFO order
More than one process enters critical section at same time
Which of the above statement is TRUE?
a only
a and b
b and c
d only
Answer: a only
Q5. Your friend wants to design synchronization primitives and tells you that he would be better off by strictly ensuring that the processes alternate the critical section. Your response would be:
That might not satisfy the “progress” requirement
That might not satisfy the “mutual exclusion” requirement
That might not satisfy the “bounded wait” requirement
I guess that would suffice.
Answer: That might not satisfy the “progress” requirement
Q6. State True/False
Bakery algorithm ensures that no process is starved.
True
False
Answer: True
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Q7. State True/ False
Message passing is slow compared to shared memory and more error prone.
True
False
Answer: True
Q8. Inter process communication with message passing, the shared memory is in
User space
Kernel space
Virtual memory
None of these
Answer: Kernel space
Q9. In a certain application, the initial value of a counting semaphore s is 10. The following operations were completed on the semaphore in the given order 5P, 20P, 2V, 18P, 5V, 10P, 1V. The new value of counting semaphore is ______ ?
Answer: -35
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Q10. If the value of a counting semaphore s = 4, then the maximum number of requests for the critical section before it blocks is _____?
0
1
2
4
Answer: 4
Q11. State True/False
It is possible to share the messages even without attaching the shared memory with the address space of calling process.
True
False
Answer: True
Q12. The variable turn can have values 0 or 1
Void Process (i)
{
while(1)
{
//Non-critical section
While (turn!=i);
// Critical section
turn = j;
}
}
The above code does not provide
Mutual exclusion
Progress
Bounded wait
None of these
Answer: Bounded wait
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Q13. Test and Set instruction, which provides hardware synchronization does not guarantee ________.
Mutual exclusion
Progress
Bounded wait
None of these
Answer: Bounded wait
Q14. Peterson’s solution is a synchronization mechanism for maximum of _____ processes.
Answer: 2
Q15. Atomic operations like test&set ensure that
They are executed in a single cycle
They can be executed in multiple cycles,no other 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: They can be executed in multiple cycles,but no other memory instruction to the same variable is executed while this instruction is executing
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
More Weeks of Introduction to Operating Systems: Click here
More Nptel Courses: Click here
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Course Name: Introduction To Operating Systems
Link of course: Click here
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
Answer: a. True
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
Q3) Peterson’s solution is a synchronization mechanism works for maximum of processes.
Answer: 2
Q4) If the value of a counting semaphore s = 5, then the maximum number of requests for the critical section before it blocks is ________ ?
Answer: 5
Q5) Context switch cannot happen while a process executing critical section.
a. True
b. False
Answer: a. True
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
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
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
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 Introduction to Operating Systems NPTEL Assignment 6 Answers
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?
Answer: -22
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
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?
Answer: 5
These are Introduction to Operating Systems NPTEL Assignment 6 Answers
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 Introduction to Operating Systems NPTEL Assignment 6 Answers
All weeks of Introduction To Operating Systems: https://progies.in/answers/nptel/introduction-to-operating-systems
More NPTEL Solutions: https://progies.in/answers/nptel

This content is uploaded for study, general information, and reference purpose only.