Question:
what is the difference between a process and a thread?
Philip Augustus
2011-10-26 19:00:18 UTC
what is the difference between a process and a thread
Four answers:
?
2011-11-03 18:40:00 UTC
Both processes and threads are independent sequences of execution.......
TweetClean
2011-11-03 09:18:10 UTC
Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.



The basic difference between a thread and a process is that the thread runs in a shared memory space while the process runs in its own memory space. An executing instance of a program is called a process and is an entity that disappears when the machine is turned off. A process is always stored in the main memory also termed as the primary memory or random access memory. Typically, a process has only one thread of control – or just one set of machine instructions executing at a time. A thread is a subset of a process but it is termed as a ‘lightweight process’, since it is similar to a real process but executes within the context of a process and shares the same resources allotted to the process by the kernel.



A process is a collection of code, memory, data and other resources. A thread is a sequence of code that is executed within the scope of the process. You can (usually) have multiple threads executing concurrently within the same process.



I hope you found this information useful.



Bob Cristello

tweetclean@yahoo.com

http://tweetclean.com
fantabulum
2011-10-26 19:24:05 UTC
"

Both threads and processes are methods of parallelizing an application. However, processes are independent execution units that contain their own state information, use their own address spaces, and only interact with each other via interprocess communication mechanisms (generally managed by the operating system). Applications are typically divided into processes during the design phase, and a master process explicitly spawns sub-processes when it makes sense to logically separate significant application functionality. Processes, in other words, are an architectural construct.



By contrast, a thread is a coding construct that doesn't affect the architecture of an application. A single process might contains multiple threads; all threads within a process share the same state and same memory space, and can communicate with each other directly, because they share the same variables.



Threads typically are spawned for a short-term benefit that is usually visualized as a serial task, but which doesn't have to be performed in a linear manner (such as performing a complex mathematical computation using parallelism, or initializing a large matrix), and then are absorbed when no longer required. The scope of a thread is within a specific code module—which is why we can bolt-on threading without affecting the broader application.

"
charolette
2016-12-08 22:28:54 UTC
" the two threads and approaches are procedures of parallelizing an utility. even nonetheless, approaches are self sufficient execution contraptions that incorporate their very own state suggestions, use their very own handle areas, and in basic terms work together with one yet another by using applying interprocess verbal replace mechanisms (generally controlled by using the working device). applications tend to be divided into approaches in the time of the layout area, and a grasp technique explicitly spawns sub-approaches whilst it truly is sensible to logically separate considerable utility function. approaches, in different words, are an architectural build. in assessment, a thread is a coding build that doesn't influence the form of an utility. A single technique might includes distinctive threads; all threads interior of a technique share an analogous state and comparable memory area, and would talk with one yet another immediately, because of the fact they share an analogous variables. Threads generally are spawned for a quick-term earnings it somewhat is often visualized as a serial activity, yet which does no longer could be executed in a linear way (including appearing a complicated mathematical computation applying parallelism, or initializing a extensive matrix), after that are absorbed whilst now no longer required. The scope of a thread is interior of a particular code module—it somewhat is why we can bolt-on threading without affecting the wider utility. "


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...