Which of the following are not shared by the threads of the same process? (a) Stack (b) Registers (c) Address Space (d) Message Queue
(a) and (b)
In an operating system, a process is an instance of a program running. It's a complete execution environment with its own private memory space, code, data, and resources like open files and signals.
A thread, on the other hand, is a lightweight unit of execution within a process. A single process can have multiple threads running concurrently. These threads share certain resources belonging to the parent process but also have some resources that are unique to each thread.
When multiple threads belong to the same process, they share several key components of that process. These shared resources allow threads to cooperate and communicate more efficiently than separate processes.
While threads share many resources, they also need their own independent components to manage their individual execution flow. These resources are unique to each thread.
Let's examine each option in the context of resources shared or not shared by threads within the same process:
Based on the analysis, the Stack and Registers are the resources listed that are specifically not shared by the threads of the same process.
The question asks which of the given resources are not shared by the threads of the same process. Our analysis confirms that the Stack and the Registers are unique to each thread and are not shared among them.
| Resource | Shared by Threads? |
|---|---|
| Stack | No |
| Registers (CPU State) | No |
| Address Space | Yes |
| Code Section | Yes |
| Data Section (Global/Static Variables) | Yes |
| Open Files | Yes |
| Signal Handlers | Yes |
| Program Counter | No (part of Registers) |
Therefore, the resources that are not shared are Stack and Registers.
| Concept | Description |
|---|---|
| Process | An independent execution unit with its own address space and resources. |
| Thread | A lightweight execution unit within a process, sharing process resources. |
| Thread Stack | Memory area unique to each thread for local variables and function calls. |
| Thread Registers | CPU state (PC, SP, etc.) unique to each thread. |
| Process Address Space | The virtual memory range shared by all threads in a process. |
Thread management is handled by the operating system's scheduler. When a context switch occurs between threads of the same process, it's often faster than a context switch between different processes because the shared resources like the address space don't need to be switched entirely. The OS only needs to save and restore the thread-specific context, mainly the registers and the stack pointer to the correct stack.
A Thread Control Block (TCB) is a data structure used by the operating system to store information about a specific thread. This information typically includes:
Understanding which resources are shared and which are thread-specific is fundamental to understanding concurrent programming and operating system concepts.
If an operating system does not allow a child process to exist when the parent process has been terminated, this phenomenon is called as-
Which of the following is not a state of a process in operating system?
User level threads are threads that are visible to the programmer and are unknown to the kernel. The operating system kernel supports and manages kernel level threads. Three different types of models relate user and kernel level threads.
Which of the following statements is/are true ?
(a)
(i) The Many - to - one model maps many user threads to one kernel thread
(ii) The one - to - one model maps one user thread to one kernel thread
(iii) The many - to - many model maps many user threads to smaller or equal kernel threads
(b)
(i) Many - to - one model maps many kernel threads to one user thread
(ii) One - to - one model maps one kernel thread to one user thread
(iii) Many - to- many model maps many kernel threads to smaller or equal user threads
Match List-I with List-II
List – I | List – II |
(a) Disk | (i) Thread |
(b) CPU | (ii) Signal |
(c) Memory | (iii) File System |
(d) Interrupt | (iv) Virtual address |