Friday, April 24, 2020

Operating systems multiple choice questions for exams - Set 13

Operating systems exams - multiple choice questions (MCQ) and answers



Operating Systems MCQ questions and answers – Set 13

1. Which of the following components of program state are NOT shared across threads in a multithreaded process?

(a) Register values
(b) Heap memory
(c) Global variables
(d) Stack memory

View Answer

Answer: (a) Register values and (d) Stack memory     
Stack memory is the static memory allocation which is attached to a thread, so when the thread exits the stack is reclaimed.
In a multi-threaded process, all of the process’ threads share the same memory and open files. Within the shared memory, each thread gets its own stack. Each thread has its own instruction pointer and registers.
Threads have private register values and private stack segments.
On the other hand, threads share the heap and global variables.

2. When a process creates a new process using the fork() operation, which of the following are shared between the parent process and the child process?
(a) Stack
(b) Heap
(c) Shared memory segments
(d) Page table

View Answer

Answer: (c) Shared memory segments   
The parent and child share only the shared memory segments. Everything else is duplicated, but the child has its own versions (changes it makes won’t be visible to the parent, and vice-versa).

3. Four necessary conditions for deadlock are Mutual exclusion, hold and wait, no preemption and ________ .

(a) Preemption
(b) Wait and die
(c) Cyclic wait
(d) Wound and wait

View Answer

Answer: (c) Cyclic wait      
Cyclic wait also called as circular wait is a concept where a set of circular chain of processes with each process holding resources which are currently being requested by the next process in the chain.

What are the four conditions that are necessary and sufficient to cause a deadlock?

  • Mutual exclusion - At least one process must be held in a non-sharable mode. At least one non-sharable resource in the system which can be used by only one process at a time.
  • Hold and wait – there must be a process holding one resource and waiting for another.
  • Circular wait – there exist a set of circular chain of processes with each process holding resources which are currently being requested by the next process in the chain.
  • No preemption – Resources cannot be preempted. Previously granted resources cannot forcibly taken away.

4. Which is not the function of a dispatcher?

(a) Switching context
(b) Switching to use mode
(c) Jumping to the proper location in the user program to restart that program
(d) None of the above

View Answer

Answer: (d) None of the above    
All options (a), (b) and (c) are the functions of dispatcher.

What is the main function of a dispatcher?

The main function of a dispatcher is to allocate a processor to a process when the processor becomes available.
The dispatcher's job is to organize and manage the ready state. It must take a process from some pool of ready processes, and to set the process running on an available processor. The two components of this operation are, selecting the process, and setting it going.

5. Shortest Remaining Time First scheduling is a special case of:

(a) Preemptive priority scheduling
(b) Non-preemptive priority scheduling
(c) Optimal scheduling algorithm
(d) None of the above

View Answer

Answer: (d) None of the above    
Shortest Remaining Time First (SRTF) scheduling algorithm is a special case of Shortest Job First (SJF) scheduling algorithm. SJF may be either preemptive or non-preemptive.


*********

Related links:




OS Interview questions with answers

solved Interview questions in operating systems

GATE questions in operating systems

MCQ Interview questions in OS

Operating systems interview questions for competitive exams

objective type OS questions for IIT JEE entrance exam

No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents