circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 
Test Your EQ #147— Answer

Answer 5
On most operating systems, a process is a complete execution context for a program that provides a high degree of isolation from other processes. A process gets its own area of virtual memory to operate in and its own set of OS resources such as file handles.

On the other hand, a thread is just a CPU execution context; it includes a set of CPU working registers and its own stack area.

A process always includes at least one thread, but some operating systems allow a process to have more than one thread. Threads running in the same process share all of the process's resources: address space, code, files, etc.

Threads in the same process are useful when you want to execute two different but very closely related pieces of code that must share a lot of data, state, etc.

Different processes are more appropriate when you want to execute two different and relatively unrelated pieces of code that do not share a significant amount of data or state.

Contributor: Naveen PN

Published: October-2002

   

E-mail eq@circuitcellar.com with questions or comments.

Back to Questions