Table of Contents
- 1 What do threads share in a process?
- 2 What resources does a thread use?
- 3 Which of the following is shared by multiple threads with in a process?
- 4 What is not shared by threads?
- 5 Which of the following are shared by threads?
- 6 What resources are used when a thread is created how do they differ from those used when a process is created?
Thread. When a process starts, it is assigned memory and resources. Each thread in the process shares that memory and resources. In single-threaded processes, the process contains one thread.
What resources does a thread use?
- A thread is a basic unit of CPU utilization, consisting of a program counter, a stack, and a set of registers, ( and a thread ID. )
- Traditional ( heavyweight ) processes have a single thread of control – There is one program counter, and one sequence of instructions that can be carried out at any given time.
Which of the following resources are shared by the threads within the same process?
The items that are shared among threads within a process are: Text segment (instructions) Data segment (static and global data)
Which of the following is are common among all the threads of a process?
The items that are shared among threads within the same process are the following: Text segment (instructions) Data segment (static and global data) BSS segment (uninitialized data)
Multiple threads of the same process share other resources of process except register, stack and stack pointer. In particular, a process is generally considered to consist of a set of threads sharing an address space, heap, static data, code segments and file descriptors.
Threads can not share stack (used for maintaining function calls) as they may have their individual function call sequence.
Which one of the following is shared by threads?
|Que.||Which one of the following is not shared by threads?|
|c.||both program counter and stack|
|d.||none of the mentioned|
|Answer:both program counter and stack|
Which of the following is are all shared by all threads in a process I program counter II stack III address space IV register?
Correct Option: B. The thread is a light weight process and all the threads in a process has share address space but other entities like, stack, PC, registers are not shared and every thread will have its own. So, option (b) is correct.
So when it comes to sharing, the code, data and heap areas are shared, while the stack area is just divided among threads. Generally, Threads are called light weight process. If we divide memory into three sections then it will be: Code, data and Stack.
What resources are used when a thread is created how do they differ from those used when a process is created?
How do they differ from those used when a process is created? Answer: Because a thread is smaller than a process, thread creation typically uses fewer resources than process creation. Creating a process requires allocating a process control block (PCB), a rather large data structure.