Computer ScienceChapter 1: Computer Systems
1.4.4 Process Management
Process Management
Explanation level
Introduction
Process management is an important task of the operating system. It allocates system resources to various processes so that they can run efficiently. Without proper process management, multiple programs running at the same time could conflict with each other and cause the computer to slow down or crash.
Definition
Process Management is the function of the operating system that creates, schedules, controls, and terminates processes. It decides which process gets to use the CPU, for how long, and when.
Main Idea
A process is a program in execution. When a program is loaded into memory and starts running, it becomes a process. The operating system manages processes by giving each one a share of CPU time, memory, and other resources, and by switching between them so that they can all make progress.
Core Concept
Process
A process is a program in execution. For example, when we write a program in C or C++ and compile it, the compiler creates a binary code. The original code and binary code are both programs. When we actually run the binary code, it becomes a process.
A process is a part of a program under execution that is scheduled and controlled by the operating system. When a program is loaded in memory for execution, it becomes a process. A program is an executable code that is stored in disk as a text file, whereas a process is a dynamic instance of a program during its execution in RAM. It represents the basic unit of work. It uses various resources of the computer such as CPU time, files, IO devices, memory, etc.
Detailed Explanation
Various States of a Process
There are five states of a process: Start, Ready, Running, Waiting, and Terminated.
Start/New State: This is the first state of a process when it is created. Any new operation or service that is requested by a program for execution by the processor is known as the new state of the process.
Ready State: A process is said to be in ready state when it is ready for execution but it is waiting to be assigned to the processor by the operating system.
Running State: A process is said to be in running state when it is being executed by the processor. A process is assigned to a processor for execution by the operating system.
Blocked State/Waiting State: A process is in blocked or waiting state when it is not under execution. It is waiting for a resource to become available.
Terminated State: A process is in terminated state when it completes its execution.
Thread and Process
In programming, there are two basic units of execution: processes and threads. They both execute a series of instructions.
- A Process is an instance of a program that is being executed. A process may be made up of multiple threads.
- A Thread is a basic ordered sequence of instructions within a process that cannot be executed independently.
The threads are made of and exist within a process; every process has at least one thread. Multiple threads can also exist in a process and share resources.
Comparison between Process and Thread
| Process | Thread |
|---|---|
| An executing instance of a program is called a process. | A thread is a subset of the process. |
| It has its own copy of the data segment of the parent process. | It has direct access to the data segment of its process. |
| Any change in the process does not affect other processes. | Any change in the thread may affect the behavior of the other threads of the process. |
| Processes run in separate memory spaces. | Threads run in shared memory spaces. |
| Process is controlled by the operating system. | Threads are controlled by the programmer in a program. |
| Processes are independent. | Threads are dependent. |
Intermediate Level
At the intermediate level, you should understand the process states and why they matter.
Why do processes have states? Because the CPU can only run one process at a time (on a single-core CPU). Other processes must wait their turn.
State transitions:
- Start → Ready: Process is created and ready to run.
- Ready → Running: OS assigns CPU to the process.
- Running → Waiting: Process needs a resource (e.g., file, input) that is not available.
- Waiting → Ready: Resource becomes available.
- Running → Terminated: Process finishes execution.
- Running → Ready: Process's time slice expires (in time-sharing systems).
Important Points
- - A process is a program in execution.
- - A program is a static file; a process is a dynamic instance.
- - Five process states: Start, Ready, Running, Waiting, Terminated.
- - A process may contain multiple threads.
- - Threads share memory; processes do not.
- - Process is controlled by OS; thread is controlled by programmer.
- - Processes are independent; threads are dependent.
Remember
- - Process = program in execution.
- - Five states: Start, Ready, Running, Waiting, Terminated.
- - Thread = subset of process.
- - Threads share memory; processes have separate memory.
- - Process controlled by OS; thread controlled by programmer.
- - Processes are independent; threads are dependent.
Common Mistakes
- - Confusing a program with a process (program is static, process is dynamic).
- - Forgetting that a process can have multiple threads.
- - Thinking that threads and processes are the same.
- - Assuming that a process in waiting state is not using CPU (it is not using CPU).
- - Confusing the ready state with the running state.
- - Forgetting that processes have separate memory spaces.
Quick Revision
- Process management allocates resources to processes.
- A process is a program in execution.
- Five states: Start, Ready, Running, Waiting, Terminated.
- Thread is a subset of a process.
- Threads share memory; processes do not.
- Process controlled by OS; thread controlled by programmer.
- Processes are independent; threads are dependent.
60-Second Revision
- Process = program in execution.
- Five states: Start, Ready, Running, Waiting, Terminated.
- Thread = subset of process; shares memory.
- Processes have separate memory spaces.
- Process controlled by OS; thread controlled by programmer.
- Warning: Don't confuse processes with programs; processes are dynamic, programs are static.
Did you understand this topic?
Your answer is saved with your learning record. It does not mark the topic as mastered.
Quick revision
Revision Zone
Review the key facts, formulas and checks before you move on.1.4.4 Process Management
Sticky Notes · Quick Revision
Key Point 1
- Process = program in execution.
Key Point 2
- Five states: Start, Ready, Running, Waiting, Terminated.
Key Point 3
- Thread = subset of process.
Key Point 4
- Threads share memory.
Key Point 5
- Processes have separate memory.
Key Point 6
- Process controlled by OS.
Key Point 7
- Threads controlled by programmer.
Same supplied content as this Notes page (shared canonical source).