Describe the difference between a Thread and a Process?
Answer Posted / anubhav
Q. What is the diff b/w Thread and Process?
Solution:
A Process has its own memory space, runtime environment
and process ID. A Thread runs inside a Process and shares its resources
with other threads.
Thread is a path of execution that run on CPU,a proccess is a collection
of threads that share the same virtual memory. A process have at least one thread of execution, and a thread always run in a process context.
Process is unit of allocation while Thread is unit of execution. Each process has one or more threads. Each thread belong to one process
The major difference between threads and processes is
1. Threads share the address space of the process that
created it; processes have their own address.
2. Threads have direct access to the data segment of its
process; processes have their own copy of the data segment
of the parent process.
3. Threads can directly communicate with other threads of
its process; processes must use interprocess communication
to communicate with sibling processes.
4. Threads have almost no overhead; processes have
considerable overhead.
5. New threads are easily created; new processes require
duplication of the parent process.
6. Threads can exercise considerable control over threads of
the same process; processes can only exercise control over
child processes.
7. Changes to the main thread (cancellation, priority
change, etc.) may affect the behavior of the other threads
of the process; changes to the parent process does not
affect child processes.
8. Thread is light weight process having its own stack but collection of related threads can share same execution memory. process is program or part of program under execution .every process can have its own execution environment.
9. A thread is code that is to be serially executed within a process. A process is a collection of virtual memory space, code, data, and system resources.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is microsoft windows sharepoint services?
What is server components?
Why do I get error message "could not load type" whenever I browse to my asp.net web site?
What is difference between view and partial view?
List all templates of the repeater control.
What is the significance of ASP.NET routing?
Do you support digital rights management to protect my videos?
How do I publish my asp.net application to my isp's web server?
a)COM Callable Wrapper b)Runtime Callable Which one of the above is Win32 API in .Net?
What is active web pages?
What is session id in web application?
Explain how cookies work.
What do you mean by serialize and marshalbyref?
Explain about Multi-Language integration?
What is mvc in asp.net tutorial? : Asp.Net MVC