IAE Academy

ISRO CS 2023 Q.48: solution and answer

ISRO 2023 · CSQ.48 · 1 mark · MCQ

Which of the following multithreading model is followed in Linux OS?

  1. (A)

    One User Thread mapping to One Kernel Thread

  2. (B)

    Many User Threads mapping to One Kernel Thread

  3. (C)

    One User Thread mapping to Many Kernel Threads

  4. (D)

    Many User Threads mapping to Many Kernel Threads

See the question in the paper

Answer and solution

ANSWER

Linux follows the one-to-one model: one user thread maps to one kernel thread, option (a).

Official answer: ASource: ISRO's revised and final answer key of 16 February 2024

  1. A multithreading model fixes how user-level threads are bound to kernel-schedulable entities. The three common models are many-to-one, one-to-one and many-to-many.

  2. In Linux, a thread made through the standard POSIX thread library (NPTL) is created with the clone() system call. Each thread gets its own kernel task, with its own task structure and scheduling entity.

  3. So every user thread corresponds to exactly one kernel thread. This is the one-to-one model, which Windows also uses.

  4. Option (b) is the many-to-one model, used by old green-thread libraries. It cannot use several processors, and one blocking call blocks every thread. Linux does not use it.

  5. Option (c) does not describe a standard model, because a single user thread is not split across several kernel threads.

  6. Option (d) is the many-to-many model, found in older Solaris and some other older systems. Linux does not use it.

  7. Therefore Linux follows the one-to-one model, option (a).

KEY IDEA

Linux creates every thread with clone(), and each thread is a separate kernel task that the scheduler sees. That makes the threading model one-to-one.

WATCH OUT FOR

Picking many-to-many because it sounds the most flexible, or many-to-one because user-level libraries are lightweight. Linux threads are scheduled individually by the kernel, so neither applies.

From the ISRO CS 2023 paper. Every question of this paper · The full paper (PDF, ISRO) · All 3 ISRO Processes & threads questions, with notes

More ISRO Processes & threads questions