Describe the difference between a Thread and a Process?

Answer Posted / rahul

A process is a collection of virtual memory space, code, data, and system resources. A thread is code that is to be serially executed within a process. A processor executes threads, not processes, so each application has at least one process, and a process always has at least one thread of execution, known as the primary thread. A process can have multiple threads in addition to the primary thread
Thread – is stream of executable code within process. They are light weight process.
All thread with in a process share process instruction,code & data segment,open file descriptor,signal handler,userID and GroupID. Thread has its own set of register including program counter,stack pointer
The major difference between threads and processes is
1.Threads(Light weight Processes) 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.If we consider running a word processing program to be a process, then the auto-save and spell check features that occur in the background are different threads of that process which are all operating on the same data set (your document).

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use polymorphism?

581


What is for loop and its syntax?

598


Why do we need oop?

671


What is class encapsulation?

604


What is an interface in oop?

597






What is polymorphism explain its types?

688


What is debug class?what is trace class? What differences are between them? With examples.

1612


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2110


Why do we use encapsulation in oops?

529


What is object in oop with example?

707


What is coupling in oops?

600


write a program to find 2 power of a 5digit number with out using big int and exponent ?

1899


is there any choice in opting subjects like 4 out of 7

1733


Why is encapsulation used?

579


What is the significance of classes in oop?

591