• edited by
29,302 views
83 83 votes

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 TRUE?

  1. On per- thread basis , the OS maintains only CPU register state . 
  2. The OS does not maintain a separate stack for each thread .
  3. On per- thread basis , the OS does not maintain virtual memory state .
  4. On per- thread basis , the OS maintains only scheduling and accounting information .

5 Answers

Best answer
138 138 votes

Answer to this question is (C).

Many of you would not agree at first So here I explain it how.

OS , on per thread basis, maintains ONLY TWO things : CPU Register state and Stack space. It does not maintain anything else for individual thread. Code segment and Global variables are shared. Even TLB and Page Tables are also shared since they belong to same process.

  1. option (A) would have been correct if 'ONLY' word were not there. It NOT only maintains register state BUT stack space also.
  2. is obviously FALSE
  3. is TRUE as it says that OS does not maintain VIRTUAL Memory state for individual thread which isTRUE
  4. This is also FALSE.
• edited by
54 54 votes

From Tanenbaum,

 

The items in the first column are process properties, not thread properties. For example, if one thread opens a file, that file is visible to the other threads in the process and they can read and write it. This is logical, since the process is the unit of resource management, not the thread. If each thread had its own address space, open files, pending alarms, and so on, it would be a separate process. What we are trying to achieve with the thread concept is the ability for multiple threads of execution to share a set of resources so that they can work together closely to perform some task.

0 0 votes

• On per-thread basis, the OS does not maintain virtual memory state. 

Why this is TRUE:

All threads belonging to the same process share the exact same address space and virtual memory state (such as the page table, code section, data section, and shared heap memory). Because the memory environment is shared globally among peer threads, the Operating System does not duplicate or maintain separate virtual memory states for each individual thread. This is the primary reason why threads have lower overhead and are considered "lightweight."

Why the other statements are FALSE:

•  "On per-thread basis, the OS maintains only CPU register state."

False. In addition to CPU registers (like the program counter), the OS must track other thread-specific components, most notably the thread stack and scheduling parameters (like thread ID and execution state).

•  "The OS does not maintain a separate stack for each thread."

False. Every thread requires its own execution history to handle local variables and function call tracking. Therefore, the OS does maintain a separate stack for each individual thread.

• "On per-thread basis, the OS maintains only scheduling and accounting information."

False. As stated above, it must also actively preserve the private CPU register contexts and stack pointers for each thread during execution.

 

Answer:
Position:
Show:

Related questions

116 116 votes
6 answers 6 answers
42.0k
42.0k views
go_editor asked Sep 29, 2014
42,037 views
Let the time taken to switch from user mode to kernel mode of execution be $T1$ while time taken to switch between two user processes be $T2$. Which of the following is c...
59 59 votes
7 answers 7 answers
39.1k
39.1k views
go_editor asked Sep 29, 2014
39,102 views
Let the page fault service time be $10$ milliseconds(ms) in a computer with average memory access time being $20$ nanoseconds (ns). If one page fault is generated every $...
76 76 votes
4 answers 4 answers
24.7k
24.7k views
go_editor asked Sep 29, 2014
24,702 views
On a non-pipelined sequential processor, a program segment, which is the part of the interrupt service routine, is given to transfer $500$ bytes from an I/O device to mem...
44 44 votes
6 answers 6 answers
18.4k
18.4k views
go_editor asked Sep 29, 2014
18,370 views
A container originally contains $10$ litres of pure spirit. From this container, $1$ litre of spirit replaced with $1$ litre of water. Subsequently, $1$ litre of the mixt...