DEV Community

Cover image for Program vs Process vs Thread
icncsx
icncsx

Posted on

6 2

Program vs Process vs Thread

Program

A program is simply an executable file that contains a set of instructions to complete a task. An application such as Chrome is one example.

Process

A process is any currently running instance of a program. So one program can have several executions (copies) of it running at once. One Chrome program can have multiple tabs/windows open. A colleague compares the relationship between a program and process to the difference between a Docker image and a container; I hope that analogy makes sense :)

Thread

One process can have multiple running threads. Put simply, a thread does lightweight, singular jobs. Threads exist for added concurrency. A process can have many jobs: think saving a file, reading keyboard input, writing logs, etc. Each thread can be responsible for its own task or "subprocess" so to speak.

Top comments (1)

Collapse
 
jimmont profile image
Jim Montgomery

This is very helpful to understand. A process is a running instance of a program, with isolated resources (memory, etc) and a collection of threads. Threads share the resources of the process, with each thread handling the scheduling and execution of respective tasks. The threads can update items in memory for other threads to do their respective thing.

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay