Wednesday, July 18, 2007

Process vs Thread

Process
  • unit of allocation
  • typically independent, and carry considerable state information
  • have separate address spaces
  • inter-process communication is expensive
  • each process has one or more threads
  • one process cannot corrupt another process
Thread
  • unit of execution
  • typically share the state information of a single process, and share memory and other resources directly
  • context switching between threads in the same process is typically faster than context switching between processes
  • inter-thread communication cheap
  • each thread belong to one process
  • one thread can write the memory used by another thread

No comments: