Process vs Thread
A
Processis simply a running programWhen you run a program, it receives the resources (memory) needed for execution from the OS and becomes a
processIn other words, a
processrefers to a running program that has been loaded from Disk into memory and can receive CPU allocation.
A
Processconsists of an address space, files, memory, and other resources needed to run the program, as well asthreads,and the
threadis what actually performs the work using theProcess's resources
A
Processincludes a process stack that holds temporary data such as function parameters, return addresses, and local variables, as well as a data section that stores global variablesAdditionally, a
processincludes a Heap, which is dynamically allocated memory during execution
Every
processhas at least onethread, and aprocesswith two or morethreadsis called a multi-threaded processTip) It is easy to understand if you think of a Thread as a worker in a workspace (factory) called a process!
There is no limit to the number of
threadsa singleprocesscan have, but since eachthreadrequires its own memory space (call stack) to perform work, the number ofthreadsthat can be created is determined by theprocess's memory limit
Last updated