Takefumi Yamamura's blog

This blog is for my memorandum about programming and English.

Happy Coding

This blog is for my memorandum

Tread vs Process


What is the difference between a thread and a process?



  • A process can be thought of as an instance of a program in execution. A process is an independent entity to which system resources( cpu time and memory) are allocated. Each process is executed in a separate address space, and one process cannot access the variables and data structures of another process. If a process wishes to access another process' resources, inter-process communications have to be used. These include pipes, files, sockets and other forms.

  • A thread exists within a process and shares the process' resources (including its heap space). Multiple threads within the same process will share the same heap space. This is very different from processes, which cannot directly access the memory of another process. Each thread still has its own registers and its own stack, but other threads can read and write the heap memory.


  • プロセスは各プロセスごとにシステムリソース(CPU時間とメモリなど)を割り当てられたインスタンスで、異なるアドレス空間で実行される。そのためプロセス間で他のプロセスのリソースにアクセスしたければ、パイプ、ファイル、ソケットなどのプロセス間通信を行う必要がある。

  • スレッドはプロセス内の同じメモリ空間を、複数のスレッドで共有する。そのため一般的に複数のスレッドが同じメモリを読み書きでき、他のプロセスが使用しているメモリにアックセウできないプロセスとはここが大きく異なる。