OT : theory : process and a thread
Hi all, What is the difference between a process and a thread - except for I know that a process has a unique PID associated with it.. -- Rohit +9122 5692 2101 D2,floor-3,Chandivali : SDE : TLSI : 9821394599@bplmobile.com The information below is compulsorily added for non-mahindrabt recepients. ********************************************************* Disclaimer This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com
Rohit wrote:
What is the difference between a process and a thread - except for I know that a process has a unique PID associated with it..
Processes are entirely separate, though they may communicate. Many applications fork processes when they want to do two things at once. For example, an application could use one process to run a clock and another to edit a file. Threads are separate sequences of execution within the same code. So two threads within the same process share global variables but not local variables. Threads are better for some applications. For example, an SQL server can use separate threads to handle separate requests while still maintaining easy access to lock information in global variables. While one thread is waiting for resources another can still execute. -- JDL
On Wed, 19 Mar 2003 08:24:12 +0000
John Lamb
Rohit wrote:
What is the difference between a process and a thread - except for I know that a process has a unique PID associated with it..
Processes are entirely separate, though they may communicate. Many applications fork processes when they want to do two things at once. For example, an application could use one process to run a clock and another to edit a file. Threads are separate sequences of execution within the same code. So two threads within the same process share global variables but not local variables.
Threads are better for some applications. For example, an SQL server can use separate threads to handle separate requests while still maintaining easy access to lock information in global variables. While one thread is waiting for resources another can still execute.
On a practical note, threaded apps still get a pid for each thread under linux, but when you view them with top, their name appears as "3". So it is useful to use the "c" option for top to see the real name of threads. I put a alias in .bashrc alias top='top c' -- use Perl; #powerful programmable prestidigitation
participants (3)
-
John Lamb
-
Rohit
-
zentara