answersLogoWhite

0


Best Answer

Threads exist within the same process; they can share memory and take less time to perform a "context switch;" they are part of the same program running in parallel processing units. Threads each have their own dedicated memory, and a shared memory area. Processes are entirely partitioned units of executing code. They cannot directly share memory with each other without assistance from the operating system, and are protected from each other by the operating system (in most modern operating systems, that is). They require more time to perform a context switch, as the entire task must be swapped out of the CPU instead of just the thread stack.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago

A thread is a thread of execution within a process. A process may be composed of one or more threads. Typically you will use the main thread (the entry point of the application) to create additional threads as required. Each thread has its own call stack (so the same function can execute in different threads) but shares the same address space as the process. When threads share the same resources, those resources must be synchronised such that when one thread is writing to a resource, all other threads are blocked from accessing that resource until the resource is unlocked by the writer. Failure to synchronise can result in data races, where a thread that is reading data might end up reading partially overwritten data. Care must also be taken to avoid deadlocks, where a thread attempts to lock a resource that can never be released. This can happen when a thread locks a resource and then attempts to lock that same resource a second time without releasing the first lock (this is particularly problematic in recursive functions). It can also happen when two separate threads attempt to lock multiple resources but do so in a different order.

Multiple threads help applications remain responsive even when the process is busy. For instance, if our application has a GUI, we would normally expect the user to be able to interact with the GUI even if the process is busy with a time-consuming task. To achieve this, our main thread simply monitors the message queue in an infinite loop. When a message to begin a task is encountered, the task can be delegated to a worker thread. Meanwhile, the main thread can continue to process other messages, which may include messages from the worker thread such as informing the main thread of its progress. Although multi-threading is by no means simple, by thinking in terms of independent or coordinated tasks that can execute concurrently, we can (generally) perform those tasks much quicker than we could by running them sequentially, and our application remains responsive.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago
  • Unlike processes, threads are not independent of one another.
  • Unlike processes, all threads can access every address in the task .
  • Unlike processes, thread are design to assist one other. Note that processes might or might not assist one another because processes may originate from different users.
This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Every process has at least one thread of execution, the main thread. However, threads can create new threads that operate concurrently with the main thread. Thus a process is a collection of one or more concurrent threads.

This answer is:
User Avatar

User Avatar

Wiki User

18y ago

Every process allocated its own data memory but all threads shares same memory .

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

a thread represents a line of execution within a process. processes can be multithreaded, that is, they can have several different lines of execution occurring simultaneously.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Both process and thread are independent sequence of execution

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

The same address space.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the relation between a thread and a process?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What is the difference between a computer process and thread in microprocessor?

A thread is a sub process in other words one process can contain multiple threads.


What is the difference between a process and thread?

The same metaphor: the difference of a person (thread) and a family (process) A process has at least 1 thread and may have many threads, while 1 thread must live within a process


Is thread as used by Intel in their marketing for Hyper-Threading Technology same as the thread that is talked about when discussing the difference between a process and a thread?

No.


What is the difference between process and thread?

Basically no difference, except that process can use many threads; thread can use only one.


Can a thread be called a process or vise versa?

No. A thread is a part of a process, but a process can not be part of a thread. Processes are always "at the top."


Can a thread create a process?

No, a thread can't create aprocess, because the environment of the thread is a part of a process which created this thread.


What is a thread in computers?

Execution context within a process is called Thread. Threads run, process does not. Every process starts with one thread.


What is the difference between thread based and process based?

Process based is much time as comparison as thread based. as well as Thread based application is cost effective. Process based application has its own address space so it take more cost. Alok Gupta. India.


If a process terminates will its thread also terminate?

yes, because if process is terminated then its related thread has no work. After completion of process the kernel generates a thread that will cancelled the thread in order to save the time and memory of CPU.


What is a thread in c?

A thread is basically a lightweight process.


What is dfference between synchronization and asynchronization in java with example?

synchornisation is the process where more than one thread can be accessed by accesssing the shared object of the class.By syncornisation we can have the communication between threads.if one thread works then another thread automatically stops


What process does cotton go through to become yar or thread?

what process turn the yarn into thread