In This Article, we are discussing about Operating System Fundamentals NPTEL Assignment Answers of Week 8 (2023)
Last Date for Week 8 :- Due date: 2023-09-20, 23:59 IST
1 ] The Banker’s algorithm
(A) is used to detect the deadlocks in the system
(B) only works for single-process systems
(C) is an approach to prevent deadlocks
(D) requires knowledge of the current resource allocation of processes
(E) is primarily used for memory management in operating systems
2 ] A computer system has four types Of resources: A, B, C and D. The system currently has 15 instances Of resource A. IO instances Of resource B. 12 instances Of resource C, and instances of resource D available. Consider the following snapshot of a system:
Process | Current allocation A B C D | Maximum demand A B C D |
P1 | 3 2 2 1 | 8 4 6 3 |
P2 | 2 1 1 2 | 6 2 3 2 |
P3 | 3 1 1 0 | 9 3 5 4 |
P4 | 1 1 1 1 | 4 2 2 1 |
Using the Banker’s algorithm, can the system avoid deadlock and be in a safe state?
(A) The system is in a safe state, the safe sequence is P1-> P2-> P3 ->P4
(B) The system is in a safe state, the safe sequence is PI-> P3 ->P2 ->P4
(C) The system is in a safe state. the safe sequence is P3-> P1-> P2 ->P4
(D) The system is in an unsafe state and may lead to a deadlock
(E) The system is in an unsafe state. but can automatically recover from a deadlock
3 ] pthread_mutex is used to
(A) create multiple threads in a program and ensure that they execute in a specific order
(B) prevent race conditions and ensure that only one thread can access the critical section a time
(C) to terminate a thread gracefully when it completes its task
(D) signal Other threads to start their execution
(E) create lightweight threads
4 ] In a multithreaded programming environment, the shared variable counter is accessed and updated by the multiple threads. To prevent race conditions and ensure that only one thread can access the variable counter at a time. which function should be used?
(A) pthread_cond_wait
(B) pthread_spin_lock
(C) pthread_mutex_join
(D) pthread_mutex_wait
(E) pthread_mutex_lock
5 ] In a Resource Allocation Graph with a cycle.
(A) Deadlock is guaranteed to occur
(B) Deadlock is possible but not guaranteed
(C) Deadlock cannot occur
(D) Deadlock resolution is automatic
(E) None of the above.
6 ] Which of the following statement is true in a Resource Allocation Graph (RAG)?
(A) Each process is represented by a separate vertex
(B) Each resource type is represented by a separate vertex
(C) Assignment edge is indicated by an arrow from a resource vertex to a process vertex
(D) Request edge is indicated by an arrow from a process vertex to a resource vertex
(E) All of the above
7 ] How to recover from the deadlock?
(A) Abort the execution of all the processes caused the deadlock
(B) Abort one process at a time until the deadlock cycle is removed
(C) Forcibly reclaims the resources held by the deadlocked processes
(D) Reclaimed resources obtained from the deadlock processes are allocated to other processes
(E) All of the above
8 ] Which of the following will impact the system performance when the system is recovering from a deadlock through process termination?
(A) The priority of processes
(B) Number Of processes to be terminated
(C) Termination of the processes which were used minimal resources
(D) Release of high-demand resources held by the deadlock processes
(E) All of the above
9 ] The wait-for graph is used to detect the deadlock in a system. The wait-for graph represents
(A) The allocation of resources to processes
(B) The requests made by processes for resources
(C) The dependencies between processes waiting for resources
(D) The scheduling order of processes in the system
(E) The memory allocation status of processes
10 ] Which data structure is needed to execute the Banker’s Algorithm?
(A) Available matrix
(B) Maximum resource matrix
(C) Allocation matrix
(D) Need matrix
(E) All Of the above
11 ] In the Dining-Philosophers problem. n philosophers sit around a table. and each philosopher must acquire two forks to eat To avoid deadlock, what is the maximum number of philosophers allowed to pick up a fork simultaneously?
(A) n
(B) n+3
(C) n(n+1)
(D) n-1
(E) 2n
12 ] What do you mean by “starvation” in the Dining-Philosophers problem?
(A) A deadlock situation where philosophers cannot make progress
(B) When all the philosophers eating continuously without thinking
(C) When all the the philosophers becomes overloaded with requests.
(D) When a philosopher is unable to pick up any forks and. therefore. cannot eat
(E) A situation where philosophers leave the table without finishing their meal.
13 ] Assume that in a system. n processes, Pl. P2- …. Pn share m identical resource units. which can be reserved and released one at a time. The maximum resource requirement Of process Pi is Si. where Si>O. Which one of the conditions ensures that deadlock will not occur?
(A) ∑Si <= m/n
(B) ∑Si <= m/2
(C) ∑Si <= n/m
(D) ∑Si <= m
(E) None of the above
14 ] Which of the following statement is true?
(A) The circular wait condition can be prevented by defining a linear ordering Of resource types.
(B) A system is in a safe state if the system can allocate resources to each process in some order and still avoid a deadlock.
(C) Deadlock prevention is a set of methods to ensure that at least one of the necessary conditions cannot hold
(D) For non-sharable resources like a printer, mutual exclusion must exist.
(E) All of the above
15 ] Consider a Resource-Allocation Graph (RAG) with four processes: Pl. P 2. P3, and P4, and three resource types: RI, R2. and R3. The system currently has two instances of resource R1, three instances of resource R2. and two instances of resource R3. The table represents the current state of the system in terms of the resources allocated and the resources requested by each process:
Process | Allocated R1 R2 R3 | Requested R1 R2 R3 |
P1 | 1 0 1 | 0 1 1 |
P2 | 1 1 0 | 1 0 0 |
P3 | 0 1 0 | 0 0 1 |
P4 | 0 1 0 | 1 2 0 |
Based on the given RAG, which of the following is a correct statement?
(A) The system is safe. and a safe sequence is P1-> P2 ->P4-> P3
(B) The system is safe. and a safe sequence is P3-> P1-> P2-> P4
(C) The system is unsafe state. and it may lead to a deadlock
(D) The system is unsafe. but it will automatically recover from a deadlock
(E) The system is safe state. and a safe sequence is P4-> P3-> P2-> P1