| Operating System Interview
Question |
|
What is the difference between preemptive scheduling and time slicing?
|
| Under preemptive scheduling, the highest priority task
executes until it enters the waiting or dead states or a higher priority task
comes into existence. Under time slicing, a task executes for a predefined
slice of time and then reenters the pool of ready tasks. The scheduler then
determines which task should execute next, based on priority and other factors. |
| What is Synchronization? |
| Synchronization is the mechanism that ensures that only one
thread is accessed the resources at a time. |
| What is difference between a
thread and process? |
|
A process is a collection of virtual memory space, code, data, and system
resources. A thread is code that is to be serially executed within a process. A
processor executes threads, not processes, so each application has at least one
process, and a process always has at least one thread of execution, known as
the primary thread. A process can have multiple threads in addition to the
primary thread. Prior to the introduction of multiple threads of execution,
applications were all designed to run on a single thread of execution.
When a thread begins to execute, it continues until it is killed or until it is
interrupted by a thread with higher priority (by a user action or the kernel’s
thread scheduler). Each thread can run separate sections of code, or multiple
threads can execute the same section of code. Threads executing the same block
of code maintain separate stacks. Each thread in a process shares that
process’s global variables and resources.
|
| What is Mutex? |
| Mutex is a program object that allows multiple program
threads to share the same resource, such as file access, but not
simultaneously. When a program is started a mutex is created with a unique
name. After this stage, any thread that needs the resource must lock the mutex
from other threads while it is using the resource. the mutex is set to unlock
when the data is no longer needed or the routine is finished |
| What is a trap and trapdoor? |
| Trapdoor is a secret undocumented entry point into a
program used to grant access without normal methods of access authentication. A
trap is a software interrupt, usually the result of an error condition |
| What is Throughput,Turnaround time,Waiting time and
Response time? |
| Throughput is the amount of work that a
computer can do in a given time period. |
| Turnaround time is the amount of time to
execute a particular process |
| Waiting time is
the amount of time a process has been waiting in the ready queue |
|
Response time is the amount of time it takes from when a
request was submitted until the first response is produced, not output (for
time-sharing environment)
|
| What is process spawning? |
| When the OS at the explicit request of another process creates a
process, this action is called process spawning |
| Reasons for Process terminations |
-
Normal completion
-
Time limit exceeded
-
Memory unavailable
-
Bounds violation
-
Protection error
-
Arithmetic error
-
Time overrun I/O failure
-
Invalid instruction
-
Privileged instruction
-
Data misuse Operator or OS intervention
-
Parent termination
|
| What is busy waiting? |
| The repeated execution of a loop of code while waiting for an event
to occur is called busy-waiting. The CPU is not engaged in any real productive
activity during this period, and the process does not progress toward
completion. |
| What is a Deadlock? |
| Deadlock is a situation when two or more processes are waiting
indefinitely for an event that can be caused by only one of the waiting
processes. The implementation of a semaphore with a waiting queue may result in
this situation |
| What is a Phantom deadlocks? |
|
In distributed deadlock detection, the delay in propagating local information
might cause the deadlock detection algorithms to identify deadlocks that do not
really exist. Such situations are called phantom deadlocks and they lead to
unnecessary aborts
|
|
|