Process Concept
- Process is a program in execution.
- A program is a passive entity, while a process is an active entity.
- Process and job are used interchangeably.
The Process
Memory Layout
Memory layout of a process is divided into sections:

Layout of a process in memory.
- Text → executable code
- Data → global variables
- Heap → dynamically allocated memory during program run time
- Stack → temporary data storage when invoking functions
- pushes activation record for each function call, which contains function parameters, local variables, return address
- pops the activation record when control is returned from the function
Multiple Processes
- Multiple processes may be associated with the same program (eg. two web browser windows open at the same time)
- Each is a separate process:
- text area (executable code) is equivalent; represents the passive information
- data, heap, stack sections are unique; represents the active information
Process State

- A process may be in one of the following states:
- New → process is being created
- Running → instructions are executing
- Waiting → process is waiting for some event to occur (eg. I/O completion, signal reception)
- Ready → process is waiting to be assigned to a processor
- Terminated → process has finished execution
- Some additional notes:
- one process can be running on a single processor core at any instant
- many processes may be ready and waiting
Process Control Block (PCB)
PCB serves as the repository for all data needed to start or restart a process, along with some accounting data.

Process control block (PCB).
Process state |
Full states list here. |
Program counter |
Address of the next instruction to be executed. |
Saved when an interrupt occurs. |
| CPU registers | Accumulators, index registers, stack pointers, general-purpose registers, condition-code information.
Saved when an interrupt occurs. |
| CPU-scheduling information | Process priority, pointers to scheduling queues, any other scheduling parameters. |
| Memory-management information | Value of the base and limit registers, page tables, segment tables. |
| Accounting information | Amount of CPU and real time used, time limits, account numbers, process numbers, etc. |
| I/O status information | List of allocated I/O devices, open files, etc. |
Threads
- Assumption so far: process is single-threaded.