Showing posts with label OS. Show all posts
Showing posts with label OS. Show all posts

Tuesday, 6 January 2015

Necessary and Sufficient Conditions for a Deadlock


Coffman (1971) identified four (4) conditions that must hold simultaneously for there to be a deadlock.

1. Mutual Exclusion Condition
The resources involved are non-shareable.
Explanation: At least one resource (thread) must be held in a non-shareable mode, that is, only one process at a time claims exclusive control of the resource. If another process requests that resource, the requesting process must be delayed until the resource has been released.


2. Hold and Wait Condition
Requesting process hold already, resources while waiting for requested resources.
Explanation: There must exist a process that is holding a resource already allocated to it while  waiting for additional resource that are currently being held by other processes.

 
3. No-Preemptive Condition
Resources already allocated to a process cannot be preempted.
Explanation: Resources cannot be removed from the processes are used to completion or released voluntarily by the process holding it.
 
 
4. Circular Wait Condition
The processes in the system, form a circular list or chain where each process in the list is waiting for a resource held by the next process in the list.

Thursday, 11 December 2014

OS Question-23

Q: Semaphore is a/an _______ to solve the critical section problem.

Options:

a) hardware for a system
b) special program for a system
c) integer variable
d) None of these

Answer: C

OS Question-22

Q: Which of the following statements are true ? (GATE 2010)
I. Shortest remaining time first scheduling may cause starvation
II. Preemptive scheduling may cause starvation
III. Round robin is better than FCFS in terms of response time

Options:

a) I only
b) I and III only
c) II and III only
d) I, II and III

Answer: D

OS Question-21

Q: Scheduling is done so as to :

Options:

a) increase the waiting time
b) keep the waiting time the same
c) decrease the waiting time
d) None of these

Answer: C

OS Question-20

Q: Which file keeps commands to execute automatically when OS is started?

Options:

a) config.sys
b) autoexec.bat
c) command.com
d) Any batch file

Answer: B

OS Question-19

Q: Scheduling is done so as to :

Options:

a) increase CPU utilization
b) decrease CPU utilization
c) keep the CPU more idle
d) None of these

Answer: A

Wednesday, 10 December 2014

OS Question-18

Q: What is CPU burst & I/O Burst?

A: CPU burst is when the process is being executed in the CPU.

I/O burst is when the CPU is waiting for I/O for further execution. After I/O burst, the process goes into the ready queue for the next CPU burst.

OS Question-17

Q: The two steps of a process execution are : (choose two)

Options:

a) I/O Burst
b) CPU Burst
c) Memory Burst
d) OS Burst

Answer: A & B

 

OS Question-16

Q: Which operating system reacts in the actual time

Options:

  1. Batch system
  2. Quick response system
  3. Real time system
  4. Time sharing system
Answer: 3

OS Question-15

Q: Disk scheduling includes deciding

Options:
  1. which should be accessed next
  2. order in which disk access requests must be serviced
  3. the physical location of the file
  4. the logical location of the file
Answer: 2

OS Qustions-14

List of scheduling algorithms are as follows:

  • First-come, first-served scheduling (FCFS) algorithm

  • Shortest Job First Scheduling (SJF) algorithm

  • Shortest Remaining time (SRT) algorithm

  • Non-preemptive priority Scheduling algorithm

  • Preemptive priority Scheduling algorithm

  • Round-Robin Scheduling algorithm

  • Multilevel Feedback Queue Scheduling(MQSF) algorithm

  • Multilevel Queue Scheduling(MQS) algorithm

OS Question-13

Q: What is pre-emptive and non-preemptive scheduling?

A: Tasks are usually assigned with priorities. At times it is necessary to run a certain task that has a higher priority before another task although it is running. Therefore, the running task is interrupted for some time and resumed later when the priority task has finished its execution. This is called preemptive scheduling.
Eg: Round robin

In non-preemptive scheduling, a running task is executed till completion. It cannot be interrupted.
Eg First In First Out

OS Question-12

Q: Which is non pre-emptive

Options:

  1. Round robin
  2. FIFO
  3. MQS
  4. MQSF
Answer: 2

OS Question-11

Q: A thread is

Options:
  1. lightweight process where the context switching is low
  2. lightweight process where the context swithching is high
  3. used to speed up paging
  4. used in dead locks
Answer: 1

OS Question-10

Q: In real time OS, which is most suitable scheduling scheme

Options:
  1. round robin
  2. FCFS
  3. pre-emptive scheduling
  4. random scheduling
Answer: 3

OS Question-9

Q: If we preempt a resource from a process, the process cannot continue with its normal execution and it must be :

Options:

a) aborted
b) rolled back
c) terminated
d) queued

Answer: B

OS Question-8

Q: The disadvantage of a process being allocated all its resources before beginning its execution is :

Options:

a) Low CPU utilization
b) Low resource utilization
c) Very high resource utilization
d) None of these

Answer: B

OS Question-7

Q: For non sharable resources like a printer, mutual exclusion :

Options:

a) must exist
b) must not exist
c) may exist
d) None of these

Answer: A
Explanation: A printer cannot be simultaneously shared by several processes.

OS Question-6

Q: Multithreaded programs are :

Options:

a) lesser prone to deadlocks
b) more prone to deadlocks
c) not at all prone to deadlocks
d) None of these

Answer: B
Explanation: Multiple threads can compete for shared resources.

OS Question-5

Q: The request and release of resources are ___________.

Options:

a) command line statements
b) interrupts
c) system calls
d) special programs

Answer: C