The operating system is responsible for managing all the programs that run on a computer. In this context, these running programs are called processes. Process management ensures that each process gets the resources it needs, even when multiple processes are active. Process management is one of the most important jobs of an operating system because it ensures all processes run smoothly without disturbing each other.
1.3.1 Process Life Cycle
A process goes through several stages during its life cycle:
1. Creation:
This happens when you start any program (like MS Word). The OS loads the program into memory and gives it the resources (like CPU time and memory) it needs.
2. Execution:
The process is actively running and performing tasks effectively.
3. Termination:
The process finishes its task and is closed by the user or the system. The OS frees the resources so they can be used by other processes.
Example: Process Lifecycle of opening a Web Browser on your mobile or computer like Google Chrome.
1. Creation: Begins when the user clicks the browser icon. The operating system loads the program into memory and allocates the required resources.
2. Execution: The browser performs tasks such as loading web pages, displaying media, and responding to user actions.
3. Termination: Occurs when the browser is closed. The operating system stops the process and releases its resources for other uses.
1.3.2 Multitasking and Concurrency
Modern operating systems can manage many processes so efficiently that it appears they are all running at the same time.
- Multitasking: The operating system allows more than one program to be open and usable by a single user at the same time. You can easily switch between them whenever you need.
- Example: You can listen to music, keep a document open, and browse the internet, moving between them as needed.
- Concurrency: More than one process is active at the same time in an OS, but the CPU processes them one by one in extremely fast cycles.
- Example: Like a chef preparing three dishes, working on one for a short time, then moving to the next, and repeating, the CPU switches between processes so rapidly that the user does not notice any delay.
1.3.3 Process Scheduling Concepts
We learned that many processes can be in progress during the same time period, but the CPU works on them one at a time in very fast turns. Since the CPU cannot run all processes at the same time, the operating system must decide:
- Which process should run first?
- How long each process should run.