# Thread

> One line of work in a running program. It shares the program's memory.

**Field:** Software Development  
**Category:** Compilers & Runtimes  
**Also known as:** Threads, Thread of Execution, Multithreading

## Think of it like

Think of it like cooks sharing one kitchen. They work at the same time, using the same pots.

## Definition

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.

## Example

Jack's photo app uses one thread to keep the screen moving. A second thread shrinks 500 photos in the background, so the app never freezes.

## Why it matters

Threads let one app do several things at once and use more than one CPU core.

## Common mistake

Letting two threads change the same data with no lock. The result changes from run to run, and the bug is hard to catch.

## Three principles

- **Inside a process.** One or many.
- **Shared memory.** Same data for all.
- **Needs care.** Locks around shared data.

## Related terms

- [Process](https://learn.benibix.com/term/development/process)
- [Concurrency](https://learn.benibix.com/term/development/concurrency)
- [Race Condition](https://learn.benibix.com/term/development/race-condition)
- [Mutex (Lock)](https://learn.benibix.com/term/development/mutex)

## Told apart from

- [Process vs Thread](https://learn.benibix.com/compare/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.

---

Source: https://learn.benibix.com/term/development/thread
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
