HELP! * GREY=local LOCAL HTML version of Foils prepared July 6,1995

Foil 4 General Concepts of Multithreading -- 2: Comparison of Threads and Processes

From Master Foils for Threads with TCE in detail CPS600 Spring Semester95 -- April 1995. by Janusz Niemiec and Geoffrey Fox * See also color IMAGE

Having many threads within one address space is a better solution than having multiple, heavy-weight processes cooperating with each other:
  • Different processes cannot easily share common data structures and other, Operating System dependent resources.
  • Switching the CPU between processes is a costly operation which requires not only the swap of machine registers but also OS specifics like the kernel stack, process stack, page tables and signal vectors. Often cache purging has to be done too. A context switch for threads can be very efficient.
  • Since there is no common address space for different processes, interaction between them (IPC) has to be carried out by the system supplied mechanisms: semaphores, shared memory, sockets, pipes etc. These interactions are much more expensive than accessing common data structures.



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Feb 18 1997