From: Rohit [mailto:rohits@mahindrabt.com] Subject: [SLE] 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.. _________________________________________________________ The high level overview goes like this: An OS contains many processes. The OS gives each process it's own unique PID, a private allotment of memory, it's own private set of slices of time to run on the CPU(s), and allotments of other resources as needed. A process contains one or more threads. Each thread has it's own thread id (TID) and shares with all other threads in the same process the memory, time, and other resources allocated to the process. All threads share the rights and permissions of the process owner. A process is dedicated to a single atomic task (meaning the task is fully independent of any other tasks). The threads within that process work together "in parallel" to accomplish the task. At least that's how the theory works, in practice the lines between a process and thread can get blurry. Processes can share memory and resources and work together to get common task accomplished (this can allow the task to get more than it's "fair share" of memory and time, and thus complete sooner). For example a small personal web server (such as TomCat) will often run entirely within a single process, but a web server that needs to handle heavy loads (such as Apache) will use many processes working together so that it can better keep up. In Linux on IBM z-Series (mainframe hardware) there is no such thing as a process, everything is a thread. To allow Linux apps to compile and run a thread is declared the parent, and it's thread id is returned as the process id. Resources are allocated to the parent thread and the child threads share all the resources of the parent thread. Grant Q