OPERATING SYSTEMS · 15 MIN READ

Processes, threads, and execution

A process supplies a protected resource context; a thread is an execution path that runs within it.

Learning objectives

  • Distinguish program, process, and thread.
  • Identify what threads generally share and what each keeps separately.

From file to running work

A program is stored code. A process is an instance of that program being executed with resources such as an address space and open files. A thread is a sequence of instructions scheduled for execution within that process. Multiple threads in one process usually share the address space and resources, while each thread has its own stack and register state.

Why threads are useful—and difficult

Threads can let one process do independent work concurrently, but shared mutable data creates race conditions. If two threads update one value without proper synchronization, their operations may interleave in an unexpected way.

Common mistakes

  • “Concurrent” does not necessarily mean executing at the same instant; scheduling and hardware decide the timing.
  • Do not assume shared memory automatically makes access safe.

References