Operating System: Question Set – 09
What are the different states of a process?
The common process states are:
- New: The process is being created.
- Ready: The process is waiting to be assigned to the CPU.
- Running: The process is being executed by the CPU.
- Waiting/Blocked: The process is waiting for some event to occur (e.g., I/O completion).
- Terminated: The process has finished execution.
What is the difference between a program and a process?
A process is how those instructions are actively carried out, whereas a program is a passive collection of instructions.
What is process scheduling?
The OS uses process scheduling to determine which programs will run on the CPU in order to maximize efficiency and resource use.
What is a context switch?
When the CPU moves from one process to another, this is known as a context switch. The current process’s state is saved, and the state of the subsequent process is loaded.
What are the different types of schedulers in an OS?
- Long-term scheduler: Decides which processes should be admitted to the system.
- Short-term scheduler: Selects which process will be executed next by the CPU.
- Medium-term scheduler: Temporarily removes processes from memory to reduce load (swapping).
What is a PCB (Process Control Block)?
All of a process’s data, including its state, program counter, CPU registers, memory management details, and I/O status, are stored in a data structure called the PCB.
What is the difference between a process and a thread?
- A process is an independent execution unit with its own memory space.
- A thread is a smaller unit of execution within a process that shares the process’s memory space.
What is inter-process communication (IPC)?
IPC is a mechanism that facilitates communication and action synchronization between processes. Shared memory, message passing, pipes, and sockets are examples of common IPC techniques.
What is a zombie process?
Zombie processes are those that have finished running but still have a record in the process table because their parent process hasn’t read their exit status yet.
What are system calls used for process management?
Common system calls include:
- fork(): To create a new process.
- exec(): To replace a process’s memory space with a new program.
- wait(): To make a parent process wait for its child process to terminate.
- exit(): To terminate a process.
How does a multitasking OS handle multiple processes?
A multitasking OS uses CPU scheduling and context switching to allow multiple processes to share the CPU efficiently.
What is a race condition in process synchronization?
When several threads or processes access shared data at once, it’s known as a race condition, and it might have unanticipated consequences.
What are semaphores and mutexes?
- Semaphore: A signaling mechanism to control access to a shared resource.
- Mutex: A locking mechanism to ensure mutual exclusion when accessing a shared resource.
What is deadlock in process management?
When a group of processes are waiting on one another to release resources, it’s called deadlock and stops any of them from moving further. Techniques for deadlock avoidance, detection, or prevention are employed to deal with this.