Introduction to Operating Systems Nptel Week 7 Answers

Are you looking for Introduction to Operating Systems Nptel Week 7 Answers? You’ve come to the right place! Access the latest and most accurate solutions for your Week 7 assignment in the Introduction to Operating Systems course.

Course Link: Click Here


These are Introduction to Operating Systems Nptel Week 7 Answers
Introduction to Operating Systems Nptel Week 6 Answers

Introduction to Operating Systems Nptel Week 7 Answers (July-Dec 2024)


  1. In the dining philosopher problem if each philosopher takes up the left fork at the same time then there will be no starvation.
    A) True
    B) False

Answer: B) False


  1. Consider the following two statements and state if they are True or False.
    I. Dining philosopher’s solution with just a mutex is more efficient than the one using the semaphores since using mutex you can have more than one philosopher eating at the same time.
    II. In the dining philosopher’s solution with semaphore and mutex a philosopher can only pick up a fork and start eating when the neighbours are not eating

A) I – False II – True
B) I – False II – False
C) I – True II – True
D) I – True II – False

Answer: A) I – False II – True


  1. Mutual exclusion means sharing of one resource by only one process at a time.
    A) True
    B) False

Answer: A) True


  1. If for a scheduler, pre-emption is intentionally turned off then it might lead to a deadlock.
    A) True
    B) False

Answer: A) True


  1. A circular wait condition is sufficient to predict whether a deadlock has occurred or not in a system having multiple instance of resources
    A) True
    B) False

Answer: B) False


  1. If the available resource entries in the available matrix cannot satisfy the entries of the request matrix then the system is definitely in a deadlock state.
    A) True
    B) False

Answer: A) True


  1. A deadlock means that the processes have been in an unsafe state sometime in the past. However processes in an unsafe state doesn’t necessarily mean they are in a deadlock state.
    A) True
    B) False

Answer: A) True


  1. Circular wait can be avoided by arranging requests in sequential or hierarchical order
    A) True
    B) False

Answer: A) True


  1. Match the following for threads
    I. Threads A – shared
    II. Stack B – shared
    III. Heap C – not shared
    IV. Global data D – light weight

A) I – D II – B III – A IV – C
B) I – D II – C III – A IV – B
C) I – C II – D III – A IV – B
D) I – D II – B III – C IV – B

Answer: B) I – D II – C III – A IV – B


  1. Processes are time efficient than threads because they do Inter Process Communication using system calls which are faster
    A) True
    B) False

Answer: B) False


These are Introduction to Operating Systems Nptel Week 7 Answers

All weeks of Introduction to Operating Systems: Click Here

For answers to additional Nptel courses, please refer to this link: NPTEL Assignment Answers

See also  Introduction To Operating Systems NPTEL Week 7 Assignment

Introduction to Operating Systems Nptel Week 7 Answers (July-Dec 2023)

Course Name: Introduction to Operating Systems

Course Link: Click Here

These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q1. State true or false.
A program to compute the sum of first 10,000 numbers can be divided into 4 sub parts and executed on 4 CPUs using either fork or threads. The reason why we prefer threads is because large portions of the data/code between the 4 sub-parts are very similar and need not be duplicated.

true
false.

Answer: true


Q2. Which of the following is false about User threads?
User threads can switch fast since it does not involve kernel.
User threads are lightweight since they do not require system calls.
Kernel is not aware of the behavior of every user threads i.e. if it is blocking or runnable.
None of these

Answer: None of these


Q3. Suppose we want to synchronize two concurrent process P and Q using binary semaphore S and T.
Process P: Process Q:
while(1){ while(1){
W: Y:
print ‘0’; print ‘1’;
print ‘0’; print ‘1’;
X: Z:
}
Synchronization statements can be inserted only at points W,X,Y,Z. Which of the following can lead to an output starting with ‘00110011’?

W : P(S) X : V(S) Y : P(T) Z: V(T) and initially S = T= 1
W : P(S) X : V(T) Y : P(T) Z: V(S) and initially S = 1 and T= 0
W : P(S) X : V(T) Y : P(T) Z: V(S) and initially S = T= 1
W : P(S) X : V(S) Y : P(T) Z: V(T) and initially S = 1 and T= 0

Answer: W : P(S)  X : V(T)  Y : P(T)  Z: V(S) and initially S = 1 and T= 0


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q4. Each process Pi where i = 1 … 9 is given as follows
pi: Repeat p10: Repeat
P(Mutex) V(Mutex)
// Critical section //critical section
V(mutex) V(mutex)
What is the largest number of process that can be inside the critical section

1
2
3
None of these

Answer: None of these


Q5. Which of the following is not valid for deadlock prevention scheme?
Release all resource before requesting a new resource
Number all resources uniquely and never request a lower numbered resource than the last one requested
Never request a resource after releasing any resource
Request and allocate all required resource before execution.

Answer: Never request a resource after releasing any resource


Q6. An OS implements a policy that requires a process to release all resources before making a request for another resource. Which of the following is true based on above statement?
Both starvation and deadlock can occur
Starvation can occur but deadlock cannot occur
Starvation cannot occur, but deadlock can occur
Neither starvation nor deadlock occur.

Answer: Starvation can occur but deadlock cannot occur


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q7. State True/ False
The following resource allocation leads to deadlock

True
False

Answer: False


Q8. Consider a situation with the dining philosopher’s problem having 5 philosophers. What is the minimum number of forks required to prevent a deadlock?
5
6
10
None of these

Answer: 6


Q9. State True/False
In dining philosopher problem (with N philosophers), all the even numbered philosophers takes the left fork first and then the right fork and all the odd numbered philosopher takes the right fork first and then the left fork. This arrangement will prevent deadlock.

True
False

See also  Introduction to Operating Systems Nptel Week 5 Answers

Answer: True


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q10. State true or false.
a. Deadlock detection is possible using the allocation and request matrices alone.
b. A way to recover from deadlock is to take away the resource from one of the processes or to kill the process itself.
c. Banker’s algorithm is used to detect deadlocks by analyzing the unsafe states.

True, True, False
False, True, True
True, False, True
False, True, False

Answer: True, True, False


Q11. Which one of the following is FALSE?
User level threads are not scheduled by the kernel.
When a user level thread is blocked, all other threads of its process are blocked.
Context switching between user level threads is faster than context switching between kernel level threads.
Kernel level threads cannot share the code segment

Answer: Kernel level threads cannot share the code segment


Q12. Consider a system has 3 process P1, P2, P3. Process P1 needs 20 units of resource R, P2 needs 15 units of R and P3 needs 5 unit of R. What is the maximum unit of resource R that leads to deadlock?
3
20
35
37

Answer: 37


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q13. A system has 5 process and 3 resources (A, B, C). The maximum count of resources are (10, 5, 7). Consider the following table of resource allocation.
State True/False
The above resource allocation leads to deadlock

True
False

Answer: False


Q14. Which one these is a safe sequence in Question 13?
P1, P3, P4 , P0, P2 only
P2, P4, P3, P1, P0 only
Both a and b
None are safe sequences

Answer: P1, P3, P4 , P0, P2 only


Q15. In a non-multiprogramming OS, a deadlock could occur
When two processes share the same resource
Can never happen
When two processes run at the same time, waiting for resources held by each other
When an interrupt occurs

Answer: Can never happen


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Introduction to Operating Systems Nptel Week 7 Answers (Jan-Apr 2023)

Course Name: Introduction To Operating Systems

Link of course: Click here


Consider a system with the above resource allocation. Answer the question 1 and 2 based on this graph.

Q1) The safe sequence of execution for the process in the above figure is
a. p3, p1, p2, p4
b. p2, p1, p4, p3
c. p3, p1, p4, p2
d. Deadlock occurs

Answer: b. p2, p1, p4, p3


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q2) Consider a situation with the dining philosopher’s problem having n philosophers. What is the minimum number of forks required to prevent a deadlock?
a. n-1
b. n
c. n+1
d. 2n

Answer: c. n+1


A system has 5 process and 3 resources (A, B, C). The maximum count of resources are (10, 5, 7). Consider the following table of resource allocation.

See also  Introduction to Operating Systems Nptel Week 2 Answers

These are Introduction to Operating Systems NPTEL Assignment 7 Answers

Q3) The above allocation result in unsafe state of the process.
a. True
b. False

Answer: b. False


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q4) Consider P1 has made a request of (1,0,2), then what will be a safe sequence?
a. P1, P2, P3, P4, P0
b. P1, P3, P0, P4, P2
c. P1, P3, P4, P0, P2
d. Unsafe sequence

Answer: c. P1, P3, P4, P0, P2


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q5) Consider a system with 6 processes, where each process needs 2 copies of Resource R. The maximum units of R required to cause deadlock is _________.

Answer: 6


Q6) Consider a system with 6 processes, where each process needs 2 copies of Resource R.The minimum units of R for deadlock free is ________.

Answer: 7


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Each process Pi where i = 1 … 9 is given as follows
pi: Repeat p10 : Repeat
P(Mutex) V(Mutex)
// Critical section //critical section
V(mutex) V(mutex)

Q7) What is the largest number of processes that can be inside the critical section
a. 10
b. 0
c. 3
d. None of these

Answer: a. 10


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q8) Consider a system has 3 process P1, P2, and P3. Process P1 needs 11 units of resource R; Process P2 needs 21 units of R and Process P3 needs 16 unit of R. What is the maximum unit of resource R that leads to deadlock?

Answer: 45


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q9) Which of the following is false about User User threads?
a. User threads can switch fast since it does involve kernel.
b. User threads are lightweight since they do not require system calls.
c. Kernel is not aware of the behavior of every user threads i.e. if it is blocking or runnable.
d. None of these

Answer: d. None of these


These are Introduction to Operating Systems NPTEL Assignment 7 Answers


Q10) Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T.
Synchronization statements can be inserted only at points W,X,Y,Z. Which of the following can lead to an output starting with ‘00110011’?

a. W : P(S) X : V(S) Y : P(T) Z : V(T) and initially S = T = 1
b. W : P(S) X : V(T) Y : P(T) Z : V(S) and initially S = 1 and T=0
c. W : P(S) X : V(T) Y : P(T) Z : V(S) and initially S = T = 1
d. W : P(S) X : V(S) Y : P(T) Z : V(T) and initially S = 1 and T = 0

Answer: b. W : P(S) X : V(T) Y : P(T) Z : V(S) and initially S = 1 and T=0