A program is executable code and data stored in a file. A process is a live execution context: it includes mapped code, memory, credentials, open file descriptors, signal state, scheduling information, and one or more threads. The same program can have many independent process instances.
Processes · Lesson 3
Process Details
Learn what state and resources distinguish a running process from a program stored on disk.
Program Instances and PIDs
For example, start cat without operands in two terminals. Each instance waits for input and has its own process ID:
$ pgrep -a cat
18420 cat
18457 cat
Both processes execute the same program, but they can have different input streams, memory contents, credentials, working directories, and lifetimes. A PID identifies one live process at a time and can later be reused after that process exits.
What distinguishes two running instances of the same program?
State Tracked by the Kernel
The kernel maintains the information required to schedule and control each process, including:
- process and parent identifiers
- user and group credentials
- virtual memory mappings
- open file descriptors and current directory
- signal dispositions and pending signals
- scheduling policy, priority, and execution state
- accounting data such as CPU time
Some underlying resources can be shared. Related processes may share mapped memory, and threads in one process share an address space and many process-wide resources. A process therefore provides isolation boundaries without implying that every byte or kernel object is physically private.
Which component maintains scheduling and credential state for Linux processes?
CPU Scheduling and Memory
Runnable threads compete for CPU time. The kernel scheduler chooses which thread runs on which CPU according to scheduling class, priority, CPU affinity, load, and policy. This is not a promise that every process receives an equal share.
Each process normally sees a virtual address space. The kernel and hardware map virtual addresses to physical memory or other backing storage, enforce protections, and can share pages where appropriate. A memory figure in ps or top is therefore not automatically the amount of unique physical RAM attributable to that process.
What does the Linux scheduler select?
Process Exit and Resource Cleanup
When a process exits, the kernel releases most of its private resources, closes remaining descriptors, and records termination information for its parent. A small process-table record can remain as a zombie until the parent retrieves the exit status. This means “the process has finished executing” and “every trace has disappeared from the process table” are not always simultaneous.
Why can an exited process briefly remain as a zombie?
Use the Manage and Monitor Linux Processes lab to start multiple instances and compare their PIDs and states. The Linux top Command lab provides a changing view of scheduling and resource metrics.
Lesson complete
You finished Process Details
You can now describe a process as more than a program file.
Distinguish stored executable code from a live process instance.
Identify the state and resources tracked by the kernel.
Relate scheduling to runnable threads rather than equal shares.
Recognize that exit status can remain until the parent collects it.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account