An Operating System (OS) is the most important system software that acts as an interface between the user and computer hardware. It manages computer resources and provides services to application programs.
An Operating System is a software that controls and coordinates the use of hardware among various application programs and users.
The Operating System serves as an intermediary between the user and computer hardware.
Makes the computer easier to use.
Example: Opening a file by double-clicking instead of writing machine instructions.
Uses hardware resources efficiently.
Example: Managing CPU time among multiple programs.
Allows new features and hardware to be added without affecting existing services.
Provides:
Operating System = Resource Manager + Control Program
Operating systems perform various operations to manage computer resources effectively.
An interrupt is a signal sent to the CPU indicating that an event needs immediate attention.
Generated by hardware devices.
Examples:
Generated by software or programs.
Examples:
To protect the system, CPUs operate in two modes.
A timer prevents programs from running forever.
Supports multitasking and fairness.
Operating systems provide services to users and programs.
Allows communication between user and computer.
Manages:
Allows:
Supports communication between processes.
Detects:
Allocates:
Tracks:
Useful in multi-user systems.
Provides:
| Service | Purpose |
|---|---|
| User Interface | Interaction with user |
| Program Execution | Run programs |
| I/O Operations | Handle devices |
| File Management | Manage files |
| Communication | Process interaction |
| Error Detection | Detect faults |
| Resource Allocation | Allocate resources |
| Accounting | Track resource use |
| Security | Protect system |
Operating systems can be organized in different structural designs.
Early versions of MS-DOS
OS is divided into layers.
Layer 0 → Hardware
Layer 1 → Basic Hardware Services
Layer 2 → Memory Management
Layer 3 → Process Management
Layer N → User Interface
Each layer uses services of lower layers.
Only essential functions remain in kernel.
Other services run in user space.
MINIX
OS divided into modules.
Linux
Combination of:
Microsoft Windows
and macOS
POINTS TO KNOW
| Structure | Advantage | Disadvantage |
|---|---|---|
| Simple | Fast | Poor security |
| Layered | Easy maintenance | Overhead |
| Microkernel | Reliable | Slower IPC |
| Modular | Flexible | Complex design |
| Hybrid | Balanced performance | More complex |
A System Call is a mechanism through which a user program requests a service from the operating system kernel.
System calls act as a bridge between user programs and the operating system.
Applications cannot directly access hardware.
Instead they request services from OS using system calls.
When saving a file:
Application → System Call → OS → Disk
Used to:
Examples:
Used to:
Examples:
Used to:
Used to:
Used for:
Used to:
| Activity | System Call Used |
|---|---|
| Open a file | open() |
| Read a file | read() |
| Save a file | write() |
| Close a file | close() |
| Create process | fork() |
| End process | exit() |
1 Unit Summarize
A process is a program that is currently running in the computer’s memory. It is an active program that uses CPU time, memory, files, and other system resources.
A process contains:
Think of a process as a student writing an exam. Each student has their own answer sheet and works independently.
A thread is the smallest unit of execution within a process.
A process may contain:
In Google Chrome:
A restaurant is a process and the workers in the restaurant are threads. Each worker performs different tasks but works for the same restaurant.
| Process | Thread |
|---|---|
| Independent execution unit | Part of a process |
| Requires more memory | Requires less memory |
| Slower creation | Faster creation |
| Has separate resources | Shares resources |
| Communication is slower | Communication is faster |
The Operating System manages processes through several operations.
A new process is created whenever a user starts a program.
The operating system decides which process gets CPU time.
The CPU executes the instructions of a process.
Typing a document after opening Word.
A process waits for an event or resource.
Waiting for:
A process ends when:
Closing a browser window.
Inter-Process Communication (IPC) is a mechanism that allows processes to communicate and exchange information with each other.
Two or more processes share a common memory area.
Multiple programs accessing the same database.
Processes communicate by sending and receiving messages.
Email communication between users.
A process changes its state during execution.
The process is being created.
Double-clicking a software icon.
The process is ready and waiting for CPU allocation.
Several applications waiting for execution.
The CPU is executing the process.
Watching a video in VLC.
The process waits for an event or resource.
Waiting for a printer to print.
The process has completed its task.
Closing Notepad after saving a file.
New
↓
Ready
↓
Running
↓
Waiting
↓
Ready
↓
Running
↓
Terminated
Process Synchronization is a technique used to coordinate multiple processes when they share common resources.
Without synchronization:
Suppose two students edit the same online document simultaneously. If both save changes at the same time, some information may be lost.
A critical section is a part of a program where shared resources are accessed. Only one process should enter the critical section at a time.