A thread is usually defined as a light weight process because an Operating…
2011
A thread is usually defined as a light weight process because an Operating System (OS) maintains smaller data structure for a thread than for a process. In relation to this, which of the following statement is correct?
- A.
OS maintains only scheduling and accounting information for each thread
- B.
OS maintains only CPU registers for each thread
- C.
OS does not maintain virtual memory state for each thread
- D.
OS does not maintain a separate stack for each thread
Attempted by 225 students.
Show answer & explanation
Correct answer: C
Key idea: threads are called lightweight because they share most of the process-level state while the OS only keeps a small per-thread context.
Per-thread state the OS maintains:
CPU register context (program counter, stack pointer, general registers) saved at context switch
Thread control block with scheduling/accounting info, thread ID, priority and state
A separate stack for each thread and thread-local storage pointers
Per-process (shared) state not repeated per thread:
Virtual memory / address space and page tables (shared by all threads of the process)
Open file table entries and other process-wide resources
Therefore, the statement "OS does not maintain virtual memory state for each thread" is correct because virtual memory is managed at the process level and shared by that process's threads; this sharing is a main reason threads are considered lightweight.
A video solution is available for this question — log in and enroll to watch it.