Process vs Thread | Simply Explained
Blog / Process vs Thread | Simply Explained
So what is the difference between a process and a thread?TL;DR Summary Before we compare the differences between processes and threads we first have to understand what a program is.A program is a sequence of instructions written in a programming languageExamples of programs include application code, like the code that runs popular applications like Google Chrome or Microsoft Word.Whereas a process is simply an instance of a program that is being executed.Each process has its own separate memory address space some common resources every process requires includes the code segment, the data segment, heap, stack and registers.A classic example of processes are tabs in Google chrome.On the other hand a thread is a unit of execution within a process.Single threaded processes are processes that contain one thread.Whereas multi threaded processes are processes that contain more than one thread, which allow the process to do several things at virtually the same time.Threads share the same memory address space as other threads within the same process, it makes communication between threads very efficient, however, a single thread can corrupt the entire process.
- A program is a sequence of instructions written in a programming language.
- A process is an instance of a program that is being executed.
- A thread is a unit of execution within a process.
Don't let one question ruin your next technical interview...