Process vs Thread
A process and a thread are both ways to run work at the same time, but they differ in what they share. A process is a running program with its own memory. It is kept apart from all the others. A thread is a line of work inside a process, and it shares that memory with the other threads. Threads are cheap and share data with ease. Processes are safer, because one crash stays inside.
Process
A running program. It has its own memory, kept apart from the rest.
A process is a program that is running, with its own space in memory. The system starts it and gives it a number called a process ID. It also keeps it apart from the rest. One process cannot read another's memory unless they agree to share. If one process crashes, the others keep going. Opening the same app twice usually starts two processes.
Thread
One line of work in a running program. It shares the program's memory.
A thread is one line of work running inside a process. A process starts with one thread and can start more. All threads in a process share its memory, so they can use the same data. That makes them cheaper to start than processes and quick to share work. It also means two threads can change the same data at once, which causes bugs.
In one line
- Process
- A running program. It has its own memory, kept apart from the rest.
- Thread
- One line of work in a running program. It shares the program's memory.