Operating Systems · Processes, Threads & System Calls
36 questions, newest first
GATE CSE has asked 36 questions on Processes, Threads & System Calls (Operating Systems) from 1993 to 2026, in 28 of the 46 papers; the most recent is in GATE CSE 2026 Set 1. In the last five years it carried 1.2 marks per 100-mark paper on average, against 0.9 since 2003. Since 2014 the questions have been 7 MSQ, 5 MCQ and 4 NAT. 5 groups of questions here are solved the same way; “One per method” keeps the newest of each.
In main, for i=0; i<3; i++, the program calls fork(). The child (fork()==0) executes continue; the parent executes break. After the loop each process executes printf("Hello!"). All forks succeed. Count executions of printf.
Answer & solution
Official answer: 4
Step through it (9 steps)
Givens and goal
In main, for i=0; i<3; i++, the program calls fork(). The child (fork()==0) executes continue; the parent executes break. After the loop each process executes printf("Hello!"). All forks succeed. Count executions of printf.
Approach
Trace which process continues the loop after each fork rather than assuming every process performs all three iterations.
Step-by-step solution
1. Begin with process P0 at i=0. It forks child P1. P0 receives a nonzero return value, skips the child branch, executes break, and prints once. 2. P1 receives zero and executes continue. In a for loop, continue proceeds to the increment i++, then tests the condition. Thus P1 reaches i=1 and forks P2. P1 then breaks and prints once; P2 continues. 3. P2 reaches i=2 and forks P3. P2 breaks and prints once. P3 continues to the increment, giving i=3, where i<3 is false. P3 exits the loop normally and prints once. 4. The process structure is a chain P0→P1→P2→P3, with exactly three successful forks and four processes. Every one reaches the single printf once, so the answer is 4. 5. The execution order of the four prints is scheduling-dependent, but the count is not. The usual 2^3=8 doubling applies only when both parent and child continue forking on later iterations; here each parent immediately leaves the loop. There is also no pre-fork buffered print in the snippet whose output could be duplicated.
A process executes one scanf, then twenty loop iterations, each doing x=x+20 and one printf. Every I/O operation sends it to an I/O queue; context switches occur both on I/O requests and on returns. Excluding initial admission, how many times does it enter the ready queue during this program? Use the question’s stipulated blocking-I/O model.
Answer & solution
Official answer: 21
Approach: Count the state transitions into Ready rather than all context switches. The scanf causes one I/O request. The loop has exactly twenty iterations, so its printf causes twenty more requests. There are 21 I/O operations in all. Each request takes the process from Running to Blocked (the I/O queue); that transition does not enter the ready queue. When each I/O operation completes, the blocked process becomes eligible to run again and enters Ready once. Thus 21 completions produce 21 ready-queue entries. The initially admitted Ready entry is explicitly excluded, giving the answer 21 rather than 22. There can be two stipulated context-switch events around an I/O episode, but they must not both be counted as Ready entries. The intended model assumes no additional time-slice or priority preemptions; such unspecified events could add entries. It also treats library I/O as blocking regardless of real-world stdio buffering.
Separate per-thread state from shared process state
Processes, Threads & System Calls
Tap to enlarge
Which thread statements are true? A Threads can exist only in kernel space. B Every thread has its own open-file descriptor table. C All threads of a process share one execution stack. D Threads in one process are not protected from each other by default.
Select all that apply
Answer & solution
Official answer: D
Approach: A process supplies a shared resource environment; a thread supplies a separate flow of execution inside it. 1. Thread management can be implemented by a user-space library, by the kernel, or by a combination. Kernel space is not the only possibility, so A is false. 2. Threads of a process normally share the process's open-file descriptor table. One thread's file operations can therefore affect descriptors available to the others. B is false. 3. Each thread needs its own program counter, register state and execution stack so that its calls and local execution can progress independently. A common address space does not mean a common stack, so C is false. 4. The stacks and other memory still lie in the shared address space. Ordinary thread boundaries do not provide the protection boundaries that separate processes have; a thread can access or corrupt another thread's memory. Thus D is true. Answer: D only.
In the standard process-state model, which direct transitions are not possible? A Running→Ready; B Waiting→Running; C Ready→Waiting; D Running→Terminated.
Select all that apply
Answer & solution
Official answer: B, C
Approach: Recall the distinction between being eligible to run, actually executing, and being blocked for an event. 1. Running→Ready is possible when the scheduler preempts a process, for example when its time slice expires. The process can still execute, but no longer holds the CPU. Thus A is not selected. 2. Waiting→Running is not a direct transition in this model. Completion of the awaited event makes the process Ready; only a later scheduling/dispatch action makes it Running. Select B. 3. Ready→Waiting is also not direct. A ready process is not executing and therefore cannot issue the blocking operation that makes it wait. It must first be dispatched to Running. Select C. 4. Running→Terminated is possible when a process exits, so D is not selected. Answer: B and C. The question is about edges of the abstract state diagram, not whether a waiting process can eventually run after passing through Ready.
The code is int x=3; while(x>0){fork(); printf("hello"); wait(NULL); x--;}. The printed question assumes successful system calls and asks how many times printf executes. The ordinary POSIX behavior of wait creates a qualification to that premise.
Answer & solution
Official answer: 14
Step through it (24 steps)
Approach: Count statement executions in the process tree, not the number of visible copies of buffered output or the number of processes at one instant. 1. At x=3, the original process forks into a parent and child. Both continue after fork and execute printf, giving 2 executions associated with that loop value. 2. Each process has its own copied x. Both eventually reach x=2, and each forks again, giving 4 printf executions at that level. At x=1, the four process lineages each fork, giving 8 more executions. 3. Total executions are 2+4+8=14. wait may delay a parent while descendants finish, so these levels need not occur simultaneously, but waiting does not erase the later iterations of the parent's loop. A newly created child initially has no child of its own. Its first wait(NULL) therefore returns −1 with ECHILD on POSIX, contradicting the blanket premise that all calls succeed. The code ignores the return value, so the intended count is still 14 when normal no-child wait failures are allowed. Buffered “hello” text can also be copied by fork; that concerns output rendering, not the number of printf executions asked here. Answer: 14 under the intended counting model. Existing discrepancy CS-2024-S1-Q57-WAIT-PREMISE remains preserved.
Running process P encounters one of these events. Which always move P to a non-running state in the intended model? A an actually blocking disk-read system call; B a page fault for a page in swap; C a disk interrupt delivering another process’s data; D a timer interrupt.
Select all that apply
Answer & solution
Official answer: A, B
Approach: Ask whether P must wait for something unavailable, rather than merely whether control enters the kernel.
1. Derivation. A genuinely blocking disk read puts P into a waiting state while I/O completes. A fault on a page currently in swap also requires storage I/O, so P is blocked pending page-in. An interrupt for another process need not deschedule P, and a timer interrupt may return to P if no switch is needed. Thus A, B. A mere user-to-kernel mode switch is not necessarily a switch to a different process; blocking in A is taken as actual blocking, as stipulated.
2. Explanation and checks. For A, the CPU cannot complete P’s read until the requested I/O finishes; for B, execution cannot retry the memory access until the swapped page is brought into memory. Both create a reason to block P and run another process or idle. In C, handling an interrupt can make a different process ready without forcing immediate preemption. In D, the scheduler may choose P again. Kernel entry and saving a trap frame alone are not the requested process context switch.
During a switch between two threads of the same process, which state needs saving? A page-table base register; B stack pointer; C program counter; D general-purpose registers. Select all applicable options.
Select all that apply
Answer & solution
Official answer: B, C, D
Threads in one process share the same virtual address space, so the page-table base normally need not change. Their stacks, instruction positions, and working register values differ, requiring preservation of stack pointer, program counter, and general-purpose registers. Thus B, C, D in the usual same-process thread model.
Teaching detail. A thread must later resume at its own instruction and restore the register values on which that computation depends. It also needs its own stack pointer because function frames and local storage belong to that thread's call chain. Threads in one process ordinarily share the page tables, so changing only the thread does not require switching the address-space root. Real implementations may save additional architecture-specific state, but that does not alter which of the four listed items are logically thread-specific in the stated model.
Which events necessarily enter kernel mode from user mode? A ordinary function call; B malloc call; C page fault; D system call. Select all.
Select all that apply
Answer & solution
Official answer: C, D
A page fault is an exception handled in kernel mode, and a system call deliberately enters kernel mode. An ordinary function call need not do so. malloc may satisfy a request from already acquired user-space allocator memory and therefore does not always invoke the kernel. Hence C, D.
Teaching detail. The word “guarantee” excludes events that merely sometimes need kernel assistance. A user-space function can manipulate registers and its stack entirely in user mode. A malloc implementation often serves a request from a previously acquired heap arena; only some calls need to request more memory from the operating system. A page fault is a processor exception and transfers control to the kernel fault handler. A system call is the designated controlled entry mechanism for requesting kernel services.
Which standard C library functions always invoke a system call when executed by a single-threaded UNIX/Linux process? Select all: A exit; B malloc; C sleep; D strlen.
Select all that apply
Answer & solution
Official answer: A; C
Normal process termination through exit eventually asks the kernel to terminate the process. A blocking sleep asks the kernel to suspend execution and arrange resumption. malloc can satisfy a request from existing user-space heap storage, and strlen scans user-space memory, so neither always needs a system call. Thus A, C in the ordinary UNIX/Linux library execution model. This is a systems-interface question, not a claim about abnormal nonreturning exit handlers or arbitrary replacement libraries.
Library routines are not synonymous with system calls. strlen needs only reads of its argument up to the terminating zero byte. malloc commonly obtains a larger region once, then fulfills many allocations from its own free lists without entering the kernel. In contrast, normal process exit changes kernel process state, and a blocking sleep requires kernel scheduling/timer support. The exam's 'always' language is interpreted under these normal library semantics.
Two separate processes each execute: global x=0 and global lock L1; main creates two threads running foo, joins both, prints x. foo has local y=0; acquire L1; x=x+1;y=y+1;release L1;print y. A both processes print x=2; B at least one prints x=4; C some thread prints y=2; D all four threads print y=1.
Select all that apply
Answer & solution
Official answer: A; D
Each process has its own address space, hence its own global x and lock. Within one process the lock serializes the two increments, giving x=2 after both threads finish. Each invocation has its own stack-local y, initialized to zero and incremented once, so every thread prints 1. The two processes do not share x merely because it is global. Thus A, D.
Threads share a process's global variables and synchronization objects, but ordinary separate processes do not share those objects without explicit shared-memory setup. Joining both threads ensures main prints after both increments. Each thread's y is an automatic local variable, so the lock is not needed to protect y, though it is needed for the shared x increment within each process.
For preemptive scheduling, which direct state transitions are possible? I running→ready; II ready→running; III blocked→running; IV blocked→ready. Options: A I,II,III; B II,III; C I,II,IV; D all four.
Your answer
Answer & solution
Official answer: C
Worked explanation
Ready means eligible to run but not currently assigned a CPU; blocked means waiting for an event and therefore not eligible. A timer interrupt can preempt a running process into ready (I). Dispatch selects a ready process to run (II). I/O completion changes blocked to ready (IV); the scheduler may then dispatch it, but that is a second transition, not the direct blocked→running edge in III. The standard graph also has running→blocked when a process requests I/O. Distinguishing a possible two-edge path from one direct transition is the key to choosing C.
Derivation and answer
Preemption gives running→ready; dispatch gives ready→running; completion of the awaited event gives blocked→ready. In the standard state-transition model a blocked process becomes ready before dispatch, not directly running. Thus I, II, IV, C.
A Unix/Linux program runs for(i=0; i<10; i++), calling fork() whenever i%2==0, then returns. Assuming all forks succeed, find the total number of newly created child processes, excluding the original process.
Answer & solution
Official answer: 31
Step through it (33 steps)
Method: count the branching rounds; every process alive at a fork round executes that fork and then continues the same loop.
1. The loop values are 0 through 9. The even values 0,2,4,6,8 cause five fork rounds; odd iterations create no processes. 2. A successful fork creates one new child from each currently executing process. Both parent and child continue from immediately after the fork with their own copy of i, so both participate in later rounds. 3. Starting from one process, the total after successive rounds is 2,4,8,16,32. The numbers of new children produced at those rounds are respectively 1,2,4,8,16. 4. Adding the created children gives 1+2+4+8+16 = 31. Equivalently, subtract the original from the final total: 25−1 = 31.
Result: 31 child processes in total, including descendants created by children. Counting only the five calls made by the original parent would omit later generations. The result assumes no fork failure or external process termination.
Threads of one process share: A globals but not heap; B heap but not globals; C neither globals nor heap; D both globals and heap.
Your answer
Answer & solution
Official answer: D
1. Threads are separate execution streams inside the same process address space. Globals live in that shared address space.
2. Heap allocations also belong to the process address space; one thread can pass an allocated object’s address to another. Sharing does not itself make unsynchronized updates safe.
3. Each thread instead has its own execution state, such as registers and program counter, and normally its own stack. Hence both heap and globals are shared, D.
Which are shared by all threads of one process? I:program counter. II:stack. III:address space. IV:registers. A:I and II. B:III only. C:IV only. D:III and IV.
Your answer
Answer & solution
Official answer: B
1. Threads belong to one process and operate in its common virtual address space, including code, global data and heap. Thus III is shared.
2. Each thread may be executing a different instruction, so it needs its own program counter and saved register values. Sharing one program counter or register context would prevent independent execution.
3. Each thread also needs its own call stack for local variables, return addresses and nested calls. Although another thread may access that stack through an address in the shared memory, the execution stack is still distinct. Hence only III is correct, B.
For a computer system with n CPUs, what is the maximum number of processes that can be in the Ready state? Options: (A) n; (B) n²; (C) 2ⁿ; (D) independent of n.
Your answer
Answer & solution
Official answer: D
1. At most n processes can execute simultaneously on n single-threaded CPUs, but that bound applies to Running, not Ready. A ready queue may contain many more processes while the CPUs execute others.
2. Ready processes are waiting to be scheduled, not currently executing. Their possible count is not bounded by the CPU count n; it depends on system/process resources. Thus independent of n, D.
Which threading statement is false? A: The kernel does not schedule user-level threads. B: If one user-level thread blocks, all other threads of its process block. C: User-level thread context switching is faster than kernel-level switching. D: Kernel-level threads cannot share the code segment. The usual intended model is many-to-one user threads with blocking system calls.
Your answer
Answer & solution
Official answer: D
Our answer: D under the many-to-one user-thread model
1. Method and setup. Separate a thread’s private execution state, such as registers and stack, from process-wide resources such as code and address space. Kernel scheduling does not imply a separate address space per thread. Statements about all user threads blocking depend on how user threads are mapped to kernel scheduling entities.
2. Work through the result and its assumptions. Kernel threads of one process share its address space, including code, so D is false. The remaining statements use the traditional many-to-one user-level-thread model and blocking kernel calls. A user-runtime wait that schedules another user thread need not block the whole process, and hybrid threading differs; the blanket wording of B needs that model.
A process executes the code fork(); fork(); fork(); The total number of child processes created is (A) 3 (B) 4 (C) 7 (D) 8
Your answer
Answer & solution
Official answer: C
Step through it (9 steps)
Assuming each fork succeeds, the first invocation creates one child, the second is executed by two processes and creates two more, and the third by four processes creates four more. There are 1+2+4=7 children, or eight total processes including the original. Hence C.
Check: Track the live population after each call as 1→2→4→8. Every new process is a child of an existing process, but the original process is not its own child, so subtracting it from the final population avoids distractor D.
Let t1 be the time to switch between user and kernel execution modes, and t2 the time to switch between two processes. Which comparison is intended to hold?
(A) t1 > t2 (B) t1 = t2 (C) t1 < t2 (D) Nothing can be said about their relation
Your answer
Answer & solution
Official answer: C
Our answer: C in the conventional OS model
A user/kernel mode switch changes privilege and performs the associated entry/exit bookkeeping without necessarily changing the current process. A process context switch additionally saves/restores execution context and changes scheduling/address-space state. In the conventional comparison this costs more, giving t1<t2, C. It is an architectural cost-model comparison, not a hardware-independent numerical law for arbitrary implementations.
A system call can enter the kernel, do work for the same process, and return without scheduling another process. In a full context switch, the OS must preserve enough state to resume one process later and load another process's state; address-space switching may also entail translation/cache overhead. Thus a mode switch is conceptually a smaller operation. The question supplies no timings from which a numerical ratio could be calculated, only this conventional ordering.
Threads are called lightweight processes because the OS maintains smaller structures for a thread than a process. Which statement is TRUE?
(A) Per thread, the OS maintains only CPU register state (B) The OS does not maintain a separate stack for each thread (C) Per thread, the OS does not maintain virtual-memory state (D) Per thread, the OS maintains only scheduling and accounting information
Your answer
Answer & solution
Official answer: C
Threads of one process share its virtual address space, so virtual-memory mappings are maintained at process level rather than separately for each thread. Each thread still needs its own register context, stack and scheduling information. Therefore C.
Independent execution requires each thread to remember its own instruction pointer and registers, and its own stack holds function calls and local execution state. The scheduler also tracks the thread's run/block status. Those facts refute A, B and D: none of the single listed items is the whole thread context, and stacks are not omitted. Virtual-memory mappings, however, describe the shared process address space, which is why C identifies the saving.
Process transitions: A Start→Ready; B Ready→Running; C Running→Ready; D Running→Terminated; E Blocked→Ready; F Running→Blocked. A uniprocessor always has some ready processes. Assess I D immediately causes another A; II E may occur while another process runs; III preemptive scheduling; IV nonpreemptive scheduling. A I/II; B I/III; C II/III; D II/IV.
Your answer
Answer & solution
Answer: C under conventional preemption labeling (no official key was published)
D terminates a running process; another ready process is dispatched through B, not newly admitted through A, so I is false. A blocked process can become ready by E while another runs, so II is true. The running-to-ready edge C represents preemption in the conventional diagram, making III true and IV false. Thus II and III, C. If C were instead explicitly defined as voluntary yield, the drawing alone would not establish preemption; the usual state-diagram convention is used.
Termination frees the CPU, so the scheduler dispatches an already ready process along B. It need not create or admit a process along A, making I false. An I/O completion can move a different process from blocked to ready while the CPU is busy, making II true. Under the conventional interpretation, C is preemption and distinguishes the diagram from a purely nonpreemptive scheduler. Thus III is selected with II; if C instead explicitly meant voluntary yield, that additional meaning would need a separate analysis.
A process executes for(i=0;i<n;i++) fork();. How many child processes are created in total, assuming all forks succeed?
(A) n (B) 2^n−1 (C) 2^n (D) 2^(n+1)−1
Your answer
Answer & solution
Answer: B (no official key was published)
Step through it (3 cases)
1. Both parent and new child continue the loop after each successful fork. Hence each iteration doubles the number of processes still executing. 2. From one process, n iterations yield 2n total processes. Equivalently the iterations create 1+2+⋯+2n−1 children. 3. Subtract the one original process: 2n−1, B. Counting only n forks by the original parent misses descendants’ forks.
Which statement about user-level and kernel-level threads is false? Options: (A) Context switches take longer for kernel-level than user-level threads (B) User-level threads need no hardware support (C) Related kernel threads may run on different processors (D) Blocking one kernel thread blocks all related threads
Your answer
Answer & solution
Answer: D (no official key was published)
1. Approach. The kernel knows about each kernel thread and can choose another runnable thread when one blocks. Contrast this with a many-to-one user-thread implementation whose sole kernel thread blocks.
2. Derivation and interpretation. Kernel threads are independently schedulable, including on different processors. Blocking one does not inherently block every sibling thread, making D false. User-level thread switching can avoid kernel entry and dedicated threading hardware under the conventional comparison; kernel scheduling manages each kernel thread separately.
Code: if(fork()==0){a=a+5;printf("%d,%d\n", a,&a);}else{a=a−5;printf("%d,%d\n", a,&a);}. Parent prints u, v and child x, y. A u=x+10, v=y; B u=x+10, v≠y; C u+10=x, v=y; D u+10=x, v≠y. Address formatting is reproduced literally and requires a portability qualification.
Your answer
Answer & solution
Answer: C, under intended address-printing semantics (no official key was published)
Let a initially equal a 0. The child executes the zero-return branch and obtains x=a 0+5; the parent obtains u=a 0−5. Therefore u+10=x. fork preserves the virtual address of a, so its address has the same numeric value in each process even though the memory is logically separate: v=y. Hence C under the intended OS model. Strictly, the printed printf uses %d for &a; that variadic type mismatch is undefined behavior in ISO C, so literal portable-C output is not guaranteed. Using %p with (void *)&a expresses the intended comparison.
fork duplicates the address-space state. The child and parent modify separate copies starting from the same initial a 0: child a 0+5, parent a 0−5, hence a difference 10. Their virtual addresses retain equal numerical locations despite distinct physical memory. This supports C as the intended OS result. The actual %d address argument is type-incorrect; use %p and a void* cast to state the intended comparison in portable C.
Regarding user-level and kernel-supported threads, select the true statements: (1) Context switching is faster with kernel-supported threads. (2) A system call by a user-level thread can block the whole process. (3) Kernel-supported threads can be scheduled independently. (4) User-level threads are transparent to the kernel. Options: (A) 2,3,4 only (B) 2,3 only (C) 1,3 only (D) 1,2 only
Your answer
Answer & solution
Answer: A (no official key was published)
1. In the conventional many-to-one user-thread model, a blocking system call can block the process, the kernel does not see individual user threads, and kernel-supported threads can be scheduled independently. Thus2,3,4 are true, A.
2. User-thread context switches normally avoid kernel transitions and are not slower by definition; statement 1 is false. Modern hybrid threading arrangements need not share the many-to-one blocking limitation.
3. Teaching check: Separate visibility from speed: the kernel schedules only what it knows about. A library can switch its user threads without a kernel transition, but a blocking call can stop their common kernel scheduling entity. Kernel-supported threads trade that limitation for kernel-managed scheduling.
Which is NOT an advantage of shared, dynamically linked libraries over statically linked libraries? A. Smaller executable files B. Lower overall page-fault rate in the system C. Faster program startup D. Existing programs need not be relinked to benefit from newer library versions
Your answer
Answer & solution
Answer: C (no official key was published)
1. Static linking copies required library code into each executable. Dynamic linking can leave that code in a separately loaded library, reducing executable size, so A is a conventional benefit. 2. Multiple processes can map the same read-only physical library pages. This reduces duplicated resident code and can reduce total memory pressure/page faults, the intended benefit in B. 3. A compatible replacement library may be used on the next load without rebuilding each application, explaining D; compatibility remains necessary. 4. Dynamic loading and symbol relocation/resolution add work at startup or first use. Faster startup is not a general advantage, so C is the requested exception. Actual cache and page-fault behavior still depends on workload.
Solution: Dynamic linking can keep library code out of the executable, share physical library pages among processes, and permit compatible library updates without relinking each application. It also introduces runtime loading, relocation, or symbol-resolution work. Faster program startup is therefore not the characteristic advantage over static linking, option C. The other listed benefits are the conventional shared-library benefits; actual page-fault and startup measurements can depend on caching and workload.
Why can dynamic linking raise security concerns? (A) Security is dynamic. (B) The search path for dynamic libraries is not known until runtime. (C) Linking is insecure. (D) Cryptographic procedures are unavailable for dynamic linking.
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: Describe the actual attack surface.
Step 2: A loader may search directories in an order influenced by environment variables, configuration or application location. If an attacker can place a library earlier in that search, the program may execute unintended code under its privileges. Restricting search paths and validating loaded libraries addresses this risk. The problem is runtime resolution policy, not an intrinsic absence of cryptographic techniques.
Conclusion: Dynamic linking may resolve library paths at runtime. If untrusted directories or mutable search-path settings influence resolution, an unintended library can be loaded. This is the security concern described by B, not a claim that every dynamic-linking configuration is insecure or that cryptography is unavailable.
Which combination suffices to characterize a multiprogrammed operating system? Features: (i) Multiple programs may be loaded into main memory simultaneously for execution; (ii) when a program waits for an event such as I/O, another is immediately scheduled; (iii) when a program terminates, another is immediately scheduled. (A) (i); (B) (i) and (ii); (C) (i) and (iii); (D) (i), (ii), and (iii).
Your answer
Answer & solution
Answer: B as the minimal defining combination (no official key was published)
Step 1: Test the weaker feature combinations.
Step 2: Multiple resident programs alone do not ensure the CPU switches away from a waiting one. Starting another program only after termination also describes a serial batch system that wastes time during I/O. Combining residency with switching on a wait supplies the distinguishing behavior. Adding termination scheduling does not logically destroy sufficiency, which is why the minimal-feature reading must be stated rather than pretending D is an impossible system.
Conclusion: Keeping multiple programs resident, (a), and switching to another ready program when one waits, (b), permit useful CPU work while I/O proceeds: the characteristic multiprogramming behavior. Thus the minimal defining combination is B. Scheduling another job after termination, (c), occurs in ordinary serial batch processing too. Literally D contains this sufficient combination as well; the usual question asks which features distinguish the model, not all logical supersets. An available ready job is implicit in the scheduling statements.
Original18(a): Draw and label the process-state transitions for an OS with states created,ready,running,blocked(sleep/wait),terminated and only non-preemptive scheduling.
Answer & solution
Answer: Created→Ready (admit); Ready→Running (dispatch); Running→Blocked (wait); Blocked→Ready (event completes); Running→Terminated (exit). (no official key was published)
Use these five labelled transitions: Created --admit--> Ready --dispatch--> Running --exit--> Terminated Running --I/O request or event wait--> Blocked Blocked --I/O or awaited event completes--> Ready The scheduler selects a ready process when the CPU becomes available. There is no timer/preemption edge from Running to Ready in the conventional non-preemptive diagram. Waking a blocked process makes it ready; it does not immediately displace the running process. A system explicitly supporting voluntary yield could add a Running→Ready edge labelled yield, but no such extra mechanism is required by the question.
What is the principal system purpose of a software interrupt: testing interrupts, implementing coroutines, requesting system services needing privileged instructions, or returning from a subroutine?
Your answer
Answer & solution
Answer: C (no official key was published)
Step 1: User-mode code cannot directly execute protected operations such as arbitrary device control. It must transfer control through an authorized entry point into the operating system.
Step 2: A software interrupt/trap provides that controlled transfer and lets the kernel execute the privileged instructions, so C. A normal subroutine return is not this transition, and coroutines can switch cooperatively without requiring a privileged trap. Testing interrupts is possible but is not their essential system-service purpose.
Which is not itself an interrupt source for a running process: a device, a timer, the scheduler process, or a detectable power failure?
Your answer
Answer & solution
Answer: C (no official key was published)
Step 1: Devices and timers can raise hardware interrupts; some systems also signal impending power failure through an interrupt or exception mechanism. These events transfer control away from a running process.
Step 2: A scheduler is software invoked after the kernel receives control, for example following a timer interrupt, blocking operation, or termination. It chooses the next runnable process but is not itself the independent hardware interrupt source.
Thus C in the conventional uniprocessor model. A complete abrupt loss of power may stop execution without a graceful interrupt, so the power-failure option presumes a detectable failure signal.
Which need not necessarily be saved: general-purpose registers, the TLB, the program counter, or all of these?
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: The process’s program counter and live architectural registers determine where and how it resumes; their values must be preserved by the switching mechanism.
Step 2: A TLB is a cache of translations also represented in page tables. It may be invalidated and refilled, or entries may remain with address-space identifiers, without saving its entire contents in the process context.
Therefore B. Losing cached translations can hurt performance but does not inherently lose the process’s architectural execution state.
Which hardware feature is essential in the standard native protected-OS model: address translation,DMA,two privilege modes,demand paging?
Select all that apply
Answer & solution
Answer: C under the protected native-execution model (no official key was published)
User code must be prevented from directly changing privileged OS state, while kernel code must be allowed to do so. Distinct privileged and unprivileged execution modes provide this boundary, motivating C. DMA is an optimization over programmed transfers; demand paging is optional; and full address translation is not the only conceivable protection mechanism. The literal word cannot is broader than the textbook model: trusted programs or an interpreter can implement multiuser services without native privilege modes. Thus the result concerns untrusted applications executing natively with hardware-enforced protection.
Which is typically NOT performed when switching A to B: save/restore registers,change translation tables,swap A’s entire memory image to disk,invalidate TLB?
Select all that apply
Answer & solution
Answer: C (no official key was published)
A context switch preserves A’s architectural state and restores B’s registers. It also selects B’s address-translation context. In a conventional untagged TLB, old translations must be invalidated to avoid interpreting B’s addresses through A’s mappings. None of this requires writing all of A’s memory to disk: both processes can remain resident. Therefore C is the operation not normally required. Tagged TLBs may avoid full invalidation, but that architectural optimization is distinct from whole-process swapping and does not turn every switch into a disk transfer.
Similar questions1 more → · asked again: GATE 1993, Q7.7
Resident loading support
Processes, Threads & System Calls
Tap to enlarge
In a resident-OS model, which software must remain available in main memory: assembler, linker, loader, compiler?
Your answer
Answer & solution
Answer: C in the traditional resident-loader model (no official key was published)
A loader brings executable code into memory and prepares it for execution. In the traditional resident monitor model, this loading support must remain available to bring in subsequent programs, motivating C. Assemblers, linkers and compilers can be ordinary separately loaded programs and need not be continuously resident. The universal wording is model-dependent: modern systems can page portions of loading software or use firmware and other mechanisms. The answer identifies the conventional resident component, not a theorem about all possible OS designs.
When an interrupt occurs, does the OS ignore it, always block the current process, always resume it, or may it block/schedule another process?
Your answer
Answer & solution
Answer: D in the broad interrupt/trap model (no official key was published)
The handler’s action depends on the event. An ordinary completed-I/O interrupt may simply update device state and return, while a fault or trap requiring an unavailable resource may block the current process and allow another to run. Thus neither always blocking nor always resuming is a general rule. D correctly expresses a possible outcome. This uses interrupt broadly enough to include synchronous traps/faults; a narrow device-only definition would need more careful distinctions about why the interrupted process blocks.
Similar questions1 more → · asked again: GATE 1998, Q1.25
What software must always remain resident
Processes, Threads & System Calls
Tap to enlarge
Which listed system software must reside in main memory under all circumstances: editor,assembler,linker,loader,or none?
Select all that apply
Answer & solution
Answer: D in the conventional resident-loader model; E for the literal universal claim (no official key was published)
A simple textbook system keeps a resident loader or loading service available to bring executable code into memory, motivating D. Editors,assemblers and linkers can be loaded only when needed. But “under all circumstances” is too strong: a bootstrap loader can finish and release its memory; loading can be implemented by firmware or by parts of an OS rather than a permanently resident standalone loader. Therefore no listed application is universally required to remain in RAM for every architecture. The conventional answer is retained conditionally, not elevated into an architecture-independent fact.