Process Concept MCQs & GATE PYQs - Operating Systems

Process Management MCQs & GATE PYQs - Operating Systems

Master Process Management for your Operating Systems course and the GATE exam. This guide covers key concepts, essential MCQs, and previous year questions (PYQs) to sharpen your skills in CPU scheduling, synchronization, and deadlock handling.

Process Management MCQs & GATE PYQs - Operating Systems

Process Management Concepts, tricks , Tips

1. The Process & Its Structure

A process is an active and dynamic program during its execution, residing in main memory. In contrast, a program is a passive set of instructions stored in secondary memory.

Process vs. Program

Feature Program Process
Nature Passive entity, a set of instructions. Active and dynamic entity.
Location Resides in secondary memory. Resides in main memory.
Resources Is not allocated any resources. Allocated resources (CPU, memory) by the OS.

Process Memory Layout:

  • Stack: For temporary data like function parameters, return addresses, and local variables.
  • Heap: Memory that is dynamically allocated during runtime.
  • Data: Contains global and static variables.
  • Text: The compiled, executable code of the program.

Process Control Block (PCB):

The OS's data structure for managing a process.

  • Key Contents: Process State, Program Counter, CPU Registers, Priority, Memory limits, List of open files/devices.
  • Implementation: All PCBs are stored in main memory, often implemented using a double linked list data structure.

2. Process vs. Thread 👨‍👦

A thread is a light-weight process. Threads of the same process share the user address space, files, and signal handlers.

Feature Process (Heavyweight) Thread (Lightweight)
Address Space Each process has its own separate address space. Threads share the address space of their parent process.
Communication Requires Inter-Process Communication (IPC). Can communicate directly through shared data.
Context Switching Slow, as the OS must change memory maps. Fast.
Creation Slow and resource-intensive. Fast and economical.
Fault Isolation If one process fails, it does not affect others. If one thread fails, it can crash the entire process.

3. Process States & Transitions

Process Location:

  • Main Memory: A process resides here when it's in the Ready, Run, or Wait state.
  • Secondary Memory: A process resides here when it's in the Suspend Ready or Suspend Block state.

Key Identifier in State Diagrams:

  • A diagram with a Running → Ready transition indicates a preemptive system.
  • A diagram without a Running → Ready transition indicates a non-preemptive system.

State Occupancy:

At any given time, only one process can exist in the Run state on a single CPU.

4. Key Process State Triggers (Cause & Effect)

Understanding what event causes which state transition is crucial.

Event Cause State Transition
Process Creation fork() system call is executed. A new process is created and placed in the Ready state.
I/O Request Process makes a blocking system call. Running → Blocked (Waiting)
Preemption Timer interrupt occurs (time slice ends). Running → Ready
Event Completion I/O operation finishes for a process. Blocked (Waiting) → Ready

5. Scheduling & Execution Flow 🚦

Schedulers:

  • Long-Term Scheduler (Job Scheduler): Selects processes to be brought into main memory. It controls the degree of multiprogramming.
  • Medium-Term Scheduler (Swapper): Handles swapping processes between main and secondary memory.
  • Short-Term Scheduler (CPU Scheduler): Selects a process from the ready queue to be executed on the CPU (Ready → Run transition).

Dispatcher:

The module that gives control of the CPU to the process selected by the short-term scheduler. It is the component that performs the context switch.

6. Context Switching & Interrupts 🔄

A context switch is the mechanism to switch the CPU from one process to another, forming the basis of multi-tasking.

What MUST be Saved:

Program Counter, CPU Registers, Memory Management Info.

What is NOT Saved (but Flushed):

Translation Look-aside Buffer (TLB). The TLB's contents are specific to the old process's address space and are invalid for the new process.

Interrupts:

A signal (usually hardware) that triggers the OS. The Scheduler is software that responds to interrupts; it does not cause them. Common hardware sources include I/O devices, the system timer, and power failure.

7. Memory Management & Special Techniques

Swap Space:

  • What: An extension of RAM.
  • Where: Resides on the Disk (HDD or SSD).
  • Why: To store inactive processes or memory pages when physical RAM is full.
  • Crucial Distinction: Swapping is a heavy memory-management operation done under memory pressure. It is NOT a routine part of every context switch.

Memory Protection:

  • Goal: To prevent a process from accessing memory outside its allocated address space.
  • Mechanism: A hardware-enforced mechanism using base and limit registers.

Checkpointing:

  • Goal: Fault tolerance for long-running jobs.
  • Mechanism: Periodically saving the process's state to persistent storage (disk). Think of it as a "save point" in a game.

8. Inter-Process Communication (IPC) 💬

Mechanisms for cooperating processes to exchange data.

  • Shared Memory: Fast, but requires manual synchronization.
  • Message Passing: Slower (kernel-mediated), but easier to manage.

9. Special Process Types

  • Zombie Process 🧟: A terminated process whose entry still exists in the process table because its parent has not yet called wait() to read its exit status.
  • Orphan Process 🧍: A process whose parent has terminated. It is adopted by the init process (PID 1).

Practice MCQs & GATE PYQs

1. Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _______. (Answer in integer) [ GATE CSE 2025 SET-1 ]

int main()
{
    int x=0,i=0;
    scanf("%d",&x);
    for(i=0; i<20; i++)
    {
         x = x + 20;
         printf("%d\n",x);
    }
    return 0;
}

2. Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)? [ GATE CSE 2024 SET-2 ]

3. Which of the following process state transitions is/are NOT possible? [ GATE CSE 2024 SET-1 ]

4. Dispatch latency is defined as.. [ ISRO CSE 2020 ]

5. The operating system and the other processes are protected from being modified by an already running process because. [ ISRO CSE 2020 ]

6. Consider the following statements about process state transitions for a system using preemptive scheduling.

  1. A running process can move to ready state.
  2. A ready process can move to running state.
  3. A blocked process can move to running state.
  4. A blocked process can move to ready state.
Which of the above statements are TRUE? [ GATE CSE 2020 ]

7. Working Set (defined by a time window 't') at an instant of time is [ ISRO CSE 2015 ]

8. Suppose a system contains 'n' processes and the system uses the round-robin algorithm for CPU scheduling. Which data structure is best suited for the ready queue of the processes? [ ISRO CSE 2015 ]

9. The maximum number of processes that can be in the Ready state for a computer system with 'n' CPUs is [ GATE CSE 2015 SET-3 ]

10. The state of a process after it encounters an I/O instruction is? [ ISRO CSE 2013 ]

11. There are three processes in the ready queue. When the currently running process requests for I/O, how many process switches take place? [ ISRO CSE 2011 ]

12. A process is [ ISRO CSE 2009 ]

13. Special software to create a job queue is called a [ ISRO CSE 2009 ]

14. Which is the correct definition of a valid process transition in an operating system? [ ISRO CSE 2009 ]

15. In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state:

Process State Transition Diagram
Now consider the following statements:

  1. If a process makes a transition D, it would result in another process making transition A immediately.
  2. A process P2 in blocked state can make transition E while another process P1 is in running state.
  3. The OS uses preemptive scheduling.
  4. The OS uses non-preemptive scheduling.
Which of the above statements are TRUE? [ GATE CSE 2009 ]

16. Which of the following need not necessarily be saved on a Context Switch between processes? 💾 [ ISRO CSE 2008 ]

17. Checkpointing a job... 💾⏱️ [ ISRO CSE 2008 ]

18. A task in a blocked state... 🚦 [ ISRO CSE 2007 ]

19. What is the name of the technique in which the operating system of a computer executes several programs concurrently by switching back and forth between them? 🔄 [ ISRO CSE 2007 ]

20. The process state transition diagram of an operating system is as given below.
Which of the following must be FALSE about the above operating system? 🤔 [ GATE IT 2006 ]

Process state transition diagram showing New to Ready, Ready to Running, and Running to Exit states.

21. What is the swap space in the disk used for? 💾↔️🧠 [ GATE CSE 2005 ]

22. Which of the following need not necessarily be saved on a context switch between processes? 🔄 [ GATE CSE 2000 ]

23. Which of the following actions is/are typically not performed by the operating system when switching context from process A to process B? 🤔 [ GATE CSE 1999 ]

24. The process state transition diagram in the below figure is representative of... [ GATE CSE 1996 ]

Process state diagram showing transitions between New, Ready, Running, Blocked, and Exit states. There is a key arrow from Running back to Ready.

25. Which of the following does not interrupt a running process? 🚫⚡️[GATE CSE 2001 ]

26. Where does the swap space reside? 💾 [ GATE CSE 2001 ]

27. In a multi-programmed operating system using preemptive scheduling, match the events in List-I with the most appropriate process state transitions in List-II.

List-I (Event)
  • P. A process makes a blocking system call for I/O.
  • Q. A timer interrupt occurs.
  • R. An I/O operation, for which a process was waiting, completes.
  • S. A running process executes a `fork()` system call.
List-II (State Transition)
  1. Running → Ready
  2. Running → Blocked (Waiting)
  3. Blocked (Waiting) → Ready
  4. A new process is created and put into the Ready state.

28. Which of the following statements accurately describe the relationship between processes and threads? 👨‍👦 (MSQ)

29. Consider the following C program. Assuming the `fork()` calls are successful, how many times will "GATE 2026" be printed? (MCQ)

#include <stdio.h>
#include <unistd.h>

int main() {
    fork();
    fork();
    printf("GATE 2026\n");
    return 0;
}

30. In an operating system, which component is directly responsible for performing the context switch by loading the state of a new process onto the CPU? (MCQ)

31. During a context switch from Process A to Process B, which of the following actions are necessarily performed by the OS? (MSQ)

32. A process is in the Suspend Blocked state, meaning it is in secondary memory and waiting for an I/O event. If the I/O event for which it was waiting completes, what is the next state for this process? (MCQ)

33. A process that has completed its execution but whose entry remains in the process table because the parent process has not yet read its exit status is known as a(n): (MCQ) 🧟

34. Among the Long-Term, Medium-Term, and Short-Term schedulers, which one is executed most frequently in a typical time-sharing operating system? (MCQ)

35. When a process running in user mode executes a system call to read a file, which of the following events occur as part of the system call mechanism? (MSQ)

36. A Process Control Block (PCB) contains various pieces of information about a specific process. Which of the following is generally NOT stored within a process's PCB? (MCQ)

37. The Long-Term Scheduler aims to maintain a good mix of CPU-bound and I/O-bound processes in memory. A process is considered I/O-bound if it: (MCQ)

38. A C program contains 4 fork() system calls executed in sequence. If all calls are successful, how many new child processes are created? (MCQ)

39. Based on the distinction between a program and a process in an operating system, which of the following statements are correct? (MSQ)

40. The transition of a process from the New state to the Ready state is the responsibility of which component? (MCQ)

Post a Comment

0 Comments