Knowledgebase

Portal Home > Knowledgebase > Articles Database > Describe the difference between a Thread and a Process?


Describe the difference between a Thread and a Process?




Posted by gaurav467, 04-19-2012, 07:12 AM
tell me please ??

Posted by scavy, 04-19-2012, 08:20 AM
Both processes and threads in order to be independent of the subject in general. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.

Posted by dale, 04-19-2012, 09:02 AM
Processes have their own state.

Posted by funkywizard, 04-19-2012, 02:08 PM
Can't a process have multiple threads? A thread is a given piece of code that can run independently of other code, such that on a multicore server, each thread can be running on each core at the same time. A process needs at least one thread, but can have more than one.

Posted by Shib, 04-19-2012, 10:12 PM
Depending on the OS really. For a user programmed thread, the thread shares resources with the parents process (like memory space, CPU time etc). For a Kernel thread, its treated the same as a process as far as the OS is concerned and gets a separate resource pool.

Posted by dale, 04-19-2012, 10:21 PM
For kernel threads, don't they share the same pool of variables? (or am I mixing up stuff again?)

Posted by Shib, 04-19-2012, 10:24 PM
Ahh dale you are right, "A kernel thread is the "lightest" unit of kernel scheduling. At least one kernel thread exists within each process. If multiple kernel threads can exist within a process, then they share the same memory and file resources." From the good ole Wiki

Posted by asv128, 06-02-2012, 09:07 AM
processes contain of threads. there can't be thread without/outside a process.

Posted by xtempore, 06-02-2012, 01:51 PM
A process contains one or more threads. Each thread executes code asynchronously from other threads.

Posted by synapsecomm, 07-10-2012, 08:42 AM
Both processes and threads are independent Terms when Program Executed . Basic difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory .

Posted by WhIteSidE, 07-13-2012, 07:27 PM
I assume for the moment that we're talking about user processes (programs you run) and not kernel stuff. To use a vehicle analogy: A process is like a vehicle, it must have at least one person (thread) inside. However, some vehicles may have more than one person. All of the people in a certain vehicle can communicate with one another easily. However, in order for people in different vehicles to communicate, both vehicles need to come to a stop so that the people can exchange notes (mutex, shm, and so forth). Thus, a each program has one process (normally) and may create additional threads inside the process to perform work more efficiently (for instance, taking a van instead of a car). Rarely (and typically on linux systems) a single program may use multiple processes instead of threads inside a process (like taking two cars instead of a van). This is rare however, as exchanging data between the processes is quite difficult.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Count days in php (Views: 527)
Help VMware ESXi 4 (Views: 535)


Language:

Contact us