GATE / CS ARCHIVE

SIMILAR QUESTIONS / OPERATING SYSTEMS

Compare user and kernel thread semantics

3 questions solved the same way, newest first. Back to Operating Systems

How these are solved

Evaluate whether the kernel can schedule individual threads, the effect of a blocking system call and which scheduling/resources are shared under user versus kernel threading.

1 mark · MCQ
Report issue

Processes, Threads & System Calls

Question 20, GATE 2014: 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.
Tap to enlarge
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.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Blocking kernel threads

Processes, Threads & System Calls

Question 17, GATE 2007: 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
Tap to enlarge
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.

Original paper, page 4

1 mark · MCQ
Report issue

User and kernel thread properties

Processes, Threads & System Calls

Question 11, GATE 2004: 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
Tap to enlarge
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.

Original paper, page 2