📝 Process Concept in the context of process implementation (35 MCQs)
Process Abstraction, Execution Context, and Kernel Representation
Process implementation belongs to process management and describes how an operating system represents and maintains executing programs. A process includes its executable code, data, stack, heap, processor state, and allocated resources. The kernel maintains a process control block (PCB) containing the process identifier, execution state, register information, scheduling attributes, and resource references, allowing execution to be interrupted and resumed safely.
Why Programs Require Individual Execution Contexts
A program stored on disk does not contain all information needed to represent an active execution. Multiple instances may execute independently, each requiring separate memory, registers, and resource ownership. The operating system therefore maintains individual execution contexts and protects them from interference. This separation supports multitasking, concurrent execution, process isolation, and controlled sharing of system resources.
PCB Organisation, Process States, and Hardware Context
When a process is created, the kernel allocates its management information and establishes its initial execution context. The PCB records its current state, while memory-management structures describe its address space. During a context switch, the kernel saves processor registers and the program counter, updates the old PCB, and restores the selected process's saved context.
Switching Between Two Processes Using Their PCBs
Suppose process P1 executes with program counter 1,200 when a timer interrupt occurs. The kernel saves its register values and program counter in P1's PCB. If P2 is selected, its saved context is restored, allowing execution to continue from its previous instruction position. P1 retains its state and can resume during a later dispatch.
Execution Isolation, Context-Switch Costs, and Resource Sharing
Process implementation provides the foundation for multitasking, protection, scheduling, and resource accounting. Separate address spaces prevent many unintended memory conflicts, while saved contexts support interrupted execution. However, PCBs, memory allocations, and context switches consume resources. Process isolation also does not eliminate the need for synchronisation when processes intentionally share memory, files, or other resources.
Misconceptions About Process Identity and Execution State
'A process is only an executable file' is incorrect because execution requires state and allocated resources. 'A PCB contains the complete program code' is incorrect because it stores management information and execution context. 'A context switch always changes process identity' is incorrect because switches can also occur between threads of the same process.
Exam Focus: PCB Fields and Process Execution Context
Identify the information maintained in a PCB and explain how it supports process execution, suspension, and resumption. Trace register and program-counter updates during context switching. Distinguish a program from a process and a process from a thread. Questions may also examine process states, address-space isolation, resource ownership, and the overhead of maintaining multiple execution contexts.
Key Terms of Process Implementation
- PCB - Kernel record containing process information.
- Process ID - Unique process identifier.
- Program counter - Address of the next instruction.
- Context switch - Saving and restoring execution state.
- Stack - Stores function calls and local data.
- Heap - Region for dynamic memory allocation.
📝 All Process Concept in the context of process implementation MCQs
Q1. Which part of a process holds local variables and function parameters during execution?
📖 Explanation: The stack stores local variables, function parameters and return addresses for each active function call. It grows and shrinks as calls are made and returned, so it is the segment that tracks the current chain of execution inside a process.
Q2. Which field of a process control block records the address of the next instruction to execute?
📖 Explanation: The program counter in the process control block stores the address of the next instruction. When the process is switched out and later resumed, the operating system restores this value so that execution continues exactly where it stopped without repeating or skipping work.
Q3. Which process state describes a process that is blocked, waiting for an event such as the completion of an input or output operation?
📖 Explanation: A waiting process cannot use the CPU even if the CPU is idle, because it is blocked on an event that has not yet occurred. Once the event completes, the process moves back to the ready state and competes for the processor again.
Q4. Which section of a process stores global and static variables that have been initialised by the programmer?
📖 Explanation: The data section holds initialised global and static variables for the lifetime of the program. Variables that persist across function calls and remain available throughout execution are placed here, separate from the stack's short-lived local data and the heap's dynamically allocated memory.
Q5. Which term describes a program that has been loaded into memory and is currently being executed by the system?
📖 Explanation: A process is an active entity: a program in execution, together with its current activity and resources. The program itself is a passive file stored on disk, and it becomes a process only when the operating system loads it and begins running its instructions.
Q6. A student believes that a program and a process are the same thing. Which correction is most accurate?
📖 Explanation: The distinction matters because one program can produce many processes, each with separate memory and state. Two users launching the same editor create two processes from one program file, which is why the operating system must track each process individually.
Q7. Why must the operating system save and restore the process control block during a context switch?
📖 Explanation: During a context switch the current state of the process, including the program counter and register values, is saved in its control block. Restoring that information later lets the process continue as if it had never been interrupted, which is the basis of multitasking.
Q8. Why is memory for dynamically allocated data typically placed in the heap rather than on the stack?
📖 Explanation: Dynamic allocation decides sizes and lifetimes at run time, and the data may need to persist beyond the function that created it. The heap supports this flexibility, whereas stack frames are released automatically when a function returns, which makes them unsuitable for data that must outlive that call.
Q9. Why is the text section of a process usually marked as read-only in memory?
📖 Explanation: The text section contains machine instructions that should not change during execution. Marking it read-only protects against corruption from bugs or attacks, and it allows several processes running the same program to share one copy of the code, saving memory.
Q10. A process issues a blocking input request. Why does the operating system move it from the running state to the waiting state rather than keeping it on the CPU?
📖 Explanation: Keeping a blocked process on the CPU would waste processor time while it does nothing useful. By moving it to the waiting state, the operating system frees the CPU to run other ready processes, which improves overall utilization and responsiveness of the system.
Q11. Which information is typically NOT stored in a process control block?
📖 Explanation: A process control block stores the state information the operating system needs to manage the process, such as identifiers, state, priority and saved registers. The source code remains a separate file on disk and is not copied into the control block, which holds only management data.
Q12. Why does the operating system need to track the state of every process at all?
📖 Explanation: Process states tell the scheduler which processes are eligible to run and which are blocked. Without accurate state information, the operating system could give the CPU to a process that cannot use it or fail to resume a process that is ready, which would disrupt correct execution.
Q13. A process moves from the new state to the ready state. Which event most likely caused this transition?
📖 Explanation: The new state represents a process that has been created but not yet admitted. When the operating system has allocated the necessary resources, the process is admitted and becomes ready to compete for the CPU, so the transition reflects admission rather than completion or blocking.
Q14. A process is created from a compiled program that declares a global array and also calls a memory allocation function at run time. Which segments hold these two kinds of data respectively?
📖 Explanation: Global arrays declared by the programmer live in the data section for the life of the program. Memory obtained through allocation at run time comes from the heap, so the segment choice follows from how and when the memory is requested. Confusing these regions is a common source of misunderstanding about process layout.
Q15. A process in the running state is interrupted and the operating system performs a context switch. Which sequence correctly describes the steps?
📖 Explanation: A context switch must first preserve the current process's state so nothing is lost. The state of the next process is then restored, and only after that can execution continue. Reversing these steps would either lose the interrupted process's progress or run the next process with the wrong state.
Q16. After a context switch, which values must be restored exactly for a process to continue correctly?
📖 Explanation: Continuing a process correctly requires the exact point of execution and the working state, which are the program counter, the registers and the stack pointer. The file name and system-wide counts are irrelevant to resuming execution, and restoring anything less would produce incorrect results or crashes.
Q17. A four-core system has 9 processes in the ready state and 2 processes in the waiting state. What is the maximum number of processes that can be in the running state at the same moment?
📖 Explanation: Each core can execute one process at a time, so at most 4 processes can be running simultaneously. The ready and waiting counts do not increase this limit; they only indicate how many processes are queued or blocked. Assuming that every process could run at once is a common error.
Q18. A process goes through these events: created, admitted, dispatched, blocked for input, input completed, dispatched again, and finally exits. Counting each change of state, how many state transitions occur if creation to ready is one transition and so on?
📖 Explanation: The sequence of state changes is new to ready, ready to running, running to waiting, waiting to ready, ready to running, and running to terminated, which gives six transitions. Counting carefully means listing every change of state rather than only the named events, which is where many students lose track.
Q19. A debugger shows that a process is in the waiting state, and its program counter keeps pointing to the same instruction for a long period. Which interpretation is most accurate?
📖 Explanation: A blocked process stops at the instruction that issued the blocking request, so its program counter stays fixed while it waits. This is normal behaviour and is not a fault by itself. The debugger evidence supports the interpretation that the process is waiting for an event rather than progressing.
Q20. Two terminals each start the same text editor program at the same time. Which statement is most accurate about the processes created?
📖 Explanation: Each launch creates a separate process with its own state, stack and heap, so the two editors are independent. Because the text section is read-only, the operating system can share the instructions between them to save memory. The option that claims shared stacks or no CPU access reflects common misconceptions.
Q21. A student says that once a process enters the waiting state, it can never return to the ready state. What is the error in this reasoning?
📖 Explanation: The waiting state is temporary: it lasts only until the event the process needs, such as input or a timer, occurs. The operating system then moves the process to the ready queue. Treating waiting as permanent would wrongly imply that many programs could never finish blocking operations.
Q22. A student claims that the process control block is stored in the program's text section so that it can be read easily. What is wrong with this claim?
📖 Explanation: The control block holds management data that the operating system must protect from user programs. Placing it in the text section would expose it and mix system data with program code, so it is kept in protected kernel memory that the process cannot modify directly.
Q23. A student says that two copies of the same program always have identical process identifiers because they come from the same file. Which evaluation is accurate?
📖 Explanation: A process identifier is assigned by the operating system when each process is created, so every process has a unique identifier regardless of the program file it came from. The program file is passive, and its identity does not determine the identity of the processes launched from it.
Q24. A student claims that both the stack and the heap of a process are fixed-size regions chosen at compile time. What is the correction?
📖 Explanation: The heap grows and shrinks dynamically according to allocation requests, and the stack also grows with function calls. Their sizes are not fixed when the program is compiled. The student's error ignores the dynamic nature of both regions, which is central to how processes manage memory.
Q25. A student says that a process in the new state already occupies the CPU while it is being admitted. What is the flaw in this claim?
📖 Explanation: The new state marks a process that is still being set up and has not been admitted into the ready queue. The CPU is used only in the running state, after admission and dispatch. Confusing creation with execution misrepresents the normal path through process states.
Q26. A table shows the time spent in each state for a process over one interval: running 4 ms, waiting 10 ms, ready 6 ms. Which inference is best supported by this data?
📖 Explanation: The waiting time of 10 ms is larger than the running time of 4 ms, so the process spends most of its time blocked on events, which is typical of I/O-bound behaviour. This inference is supported by the data, though it describes one interval and should be confirmed over longer observation.
Q27. A system records how many processes are in each state at two moments: at time 0 there are 5 ready, 1 running and 2 waiting; at time 5 there are 2 ready, 1 running and 5 waiting. What is the best inference?
📖 Explanation: The count of waiting processes rose from 2 to 5 while ready processes fell from 5 to 2. This shift indicates that more processes are being blocked on events, which could point to I/O contention or slow devices. The inference is drawn directly from the change in state counts over the two observation times.
Q28. A line graph plots the program counter of a process against time. The value rises steadily, then stays flat for a long interval at one address before rising again. What does the flat region most likely indicate?
📖 Explanation: A flat program counter over an interval means execution has stopped at one instruction, which is typical of a process blocked on a request. The counter rises again once the event completes and execution resumes. Reading this pattern correctly identifies the waiting period without needing any other data.
Q29. A bar chart shows the number of context switches per second for three programs: program A 50, program B 2000, program C 10. Which program is most likely to be I/O-bound, given that frequent blocking increases switching?
📖 Explanation: Frequent context switches often occur when processes block and yield the CPU repeatedly, which is characteristic of I/O-bound work. Program B has by far the highest count, so it is the most likely candidate. The inference is a reasoned guess from the pattern, not a certainty.
Q30. Which combination correctly describes what the operating system saves when a running process is moved to the waiting state?
📖 Explanation: Moving a process out of the running state requires saving its program counter, registers and updating its state to waiting in the control block. This preserves enough information to resume the process later. The other options describe data that is unrelated to the process's execution state.
Q31. Which pairing correctly matches a memory section with its lifetime?
📖 Explanation: Local variables live on the stack and are released when their function returns, which matches the option. Local variables are not in the data section, the heap holds dynamically allocated memory rather than instructions, and the text section contains the program's code, so the other pairings contain errors.
Q32. A process in the waiting state is holding memory and open files but no CPU. Which statement is correct about its resources?
📖 Explanation: A waiting process retains its allocated memory and open files because it still needs them when the event completes. What it gives up is the CPU, which becomes available to other processes. Releasing all resources on blocking would force the process to reacquire them, which is inefficient and unnecessary.
Q33. A system has 1024 processes, and each process control block requires 2 KB of memory. What total memory do the control blocks require, expressed in megabytes?
📖 Explanation: The total is KB, which equals MB. The large number of processes multiplies a modest per-process cost into a significant total, which is why control block size matters for systems that support many concurrent processes.
Q34. A process spends 60 percent of its time waiting for events and 40 percent running on the CPU. Five identical processes share a single CPU, and their waiting periods overlap independently. Approximately what fraction of time is the CPU busy?
📖 Explanation: The CPU is idle only when all five processes are waiting at the same time, which happens with probability . The CPU is therefore busy with probability , or about 92 percent. This assumes independent waiting, which is an idealised model rather than an exact measurement.
Q35. Why does a process that has been admitted into memory not necessarily start executing immediately?
📖 Explanation: Admission places a process in memory and the ready queue, but the CPU is shared among many ready processes. The dispatcher chooses which ready process runs next, so a newly admitted process may wait its turn. This separation between admission and dispatch is central to how the operating system manages multiprogramming.