An operating system (OS) is the core software that manages all the hardware and software resources of
a computer, acting as a crucial intermediary between the user and the computer's physical components.
Classification by Functionality and Use
Operating systems can be broadly categorized based on their intended use, capabilities, and the number
of users or tasks they are designed to handle.
Single-User, Single-Task OS: This is the most basic type, designed to allow a single user to
perform one task at a time. A classic example is MS-DOS, where you would run a single program
(e.g., a word processor) and then exit to run another.
Single-User, Multi-Tasking OS: This is the most common type for personal computers. It allows
one user to run multiple applications concurrently. While you might be browsing the web, you
can also be listening to music and have a document open for editing. Windows, macOS, and
Linux are prime examples.
Multi-User OS: This type allows multiple users to access and use a single computer
simultaneously. These systems are typically found on servers or mainframes and use time-
sharing to allocate resources fairly among all users. UNIX, Linux, and Windows Server are
examples of multi-user operating systems.
Real-Time OS (RTOS): An RTOS is designed for applications with strict time constraints,
guaranteeing that a task will be completed within a specific deadline. They are essential for
systems where timely response is critical.
o Hard Real-Time: Missing a deadline is a critical failure. Used in systems like aircraft
control, pacemakers, and industrial robots.
o Soft Real-Time: Missing a deadline is not ideal but won't cause catastrophic failure. Used
in applications like multimedia streaming and online gaming.
Embedded OS: These are small, specialized operating systems designed for devices with limited
resources and specific functions. They are built into devices and are not meant to be changed by
the user. Think of the OS in your smart TV, microwave, or digital camera.
Network OS (NOS): This type of OS runs on a server and manages network resources, providing
services like user management, data security, and file sharing for all the computers connected to
the network. Windows Server and Red Hat Enterprise Linux are often used as network
operating systems.
Distributed OS: A distributed OS manages a collection of networked computers, making them
appear to the user as a single, unified system. This enables resource sharing, load balancing, and
increased fault tolerance. This is the foundation of many cloud computing environments.
Mobile OS: Optimized for the unique needs of mobile devices like smartphones and tablets.
These operating systems prioritize a touch-based interface, wireless connectivity, and power
efficiency. The most dominant examples are Android and iOS.
Popular Operating Systems
While the above categories describe the "type" of OS, here are some of the most well-known kinds of
operating systems in use today:
Microsoft Windows: The most widely used OS for personal computers globally, known for its
user-friendly graphical interface and broad software and hardware compatibility.
macOS: Apple's proprietary OS for its Macintosh computers. It's known for its clean design,
integration with Apple's ecosystem, and strong performa nce in creative and professional fields.
Linux: An open-source, flexible, and powerful OS. It comes in many variations (called
distributions) like Ubuntu, Fedora, and Mint. Linux dominates the server, supercomputing.
An operating system performs several critical functions to manage a computer's resources and provide
an environment for running applications. These functions include:
Process Management: The OS manages running programs, called processes. This involves
creating and terminating them, scheduling them to share the CPU, and enabling communication
between different programs.
Memory Management: It handles the allocation and deallocation of a computer's memory. The
OS keeps track of which parts of memory are in use and by which programs, preventing them
from interfering with each other.
File Management: The OS organizes and manages all files and folders on storage devices. It
provides a structured way to store, retrieve, and modify data, while also managing file
permissions.
Device Management: It controls and coordinates communication with all hardware devices (like
the mouse, keyboard, and printer) using device drivers.
User Interface (UI): The OS provides a way for users to interact with the computer. This is either
through a graphical user interface (GUI) with icons and windows or a command-line interface
(CLI) with text-based commands.
Security and Protection: It protects the system from unauthorized access and malicious software
by managing user accounts, permissions, and isolating different processes to prevent errors from
spreading
A process is a program in execution. It's an active entity, unlike a program file which is a passive set of
instructions. A single program, like a web browser, can have multiple processes running at once (e.g., a
process for each tab).
Process management is a core function of the operating system that handles all aspects of a process's
life, from its creation to its termination. It ensures that multiple programs can run at the same time
efficiently and without interfering with each other.
Key Functions of Process Management
Process Creation and Termination: The OS creates a new process when a user launches a
program. It also handles the proper termination of processes when they finish or are stopped.
Process Scheduling: This is arguably the most crucial part of process management. In a
multitasking environment, the OS's scheduler decides which process gets to use the CPU at any
given time and for how long. The goal is to maximize CPU utilization, provide a fast response
time, and ensure fairness among all processes.
Process Synchronization: The OS provides mechanisms (like semaphores or mutexes) to
coordinate processes that need to access shared resources. This prevents race conditions, where
multiple processes attempt to modify the same data simultaneously, resulting in unpredictable
outcomes.
Inter-Process Communication (IPC): The OS allows different processes to communicate and
exchange data with each other. This is essential for cooperative tasks and can be done through
hmethods like shared memory or message passing.
Deadlock Handling: A deadlock occurs when two or more processes are stuck, waiting for a
resource that the other process has locked. The OS has strategies to prevent, avoid, or detect
and resolve deadlocks to keep the system running. (Bankers Algorithm) .
Operating systems fail to give the processes
Key Concepts
Thread vs. Process: A process is an independent instance of a running program with its own
private memory and resources. A thread is a lightweight component of a process. Threads within
the same process can run at the same time and share the process's resources. Think of a process
as a whole house and threads as different people living in that house, sharing the same kitchen
and living room but each doing their own tasks.
Concurrency vs. Parallelism:
o Concurrency is when multiple tasks make progress over the same period. This is often
achieved on a single-core CPU by the OS quickly switching between threads, giving the
illusion of simultaneous execution.
o Parallelism is when tasks are truly running at the same time on different processor
cores. Threading is what allows a program to take advantage of multi-core CPUs for true
parallelism.
Advantages of Threading:
o Improved Responsiveness: An application can remain responsive while performing a
time-consuming task in a separate thread. For example, a word processor can save a file
in the background while the user continues typing.
o Resource Sharing: Threads within a process share resources, which is more efficient
than creating multiple separate processes.
o Faster Execution: By dividing a task into smaller parts that can be executed concurrently,
a program can run faster on multi-core processors.
o Lower Overhead: Creating and managing threads is generally less resource-intensive
than creating and managing entire processes.
Types of Threads
User-Level Threads: These are managed entirely by the application and the user-level thread
library. The OS is not aware of these individual threads. This is fast and easy to implement, but if
one user-level thread performs a blocking I/O operation (like waiting for a file to load), the entire
process and all its threads will be blocked.
Kernel-Level Threads: These are managed directly by the operating system kernel. The OS
scheduler can manage each thread individually, allowing for true parallelism on multi-core
systems. If one kernel thread is blocked, the OS can schedule another thread from the same
process to run. Most modern operating systems support kernel-level threading.
What is Scheduling?
Scheduling is the process of deciding which of the many competing processes or threads in the ready
state will be allocated to the CPU for execution. The goal is to maximize the utilization of system
resources and ensure that all processes are handled efficiently and fairly.
Key Goals of Scheduling
An effective scheduling policy aims to achieve several goals:
Fairness: Every process should get a fair share of CPU time, preventing any one process from
monopolizing the processor.
CPU Utilization: The scheduler should keep the CPU as busy as possible, avoiding idle time.
Throughput: This is the number of processes completed per unit of time. The scheduler tries to
maximize this value.
Turnaround Time: The total time from when a process is submitted until it is completed. The
scheduler aims to minimize this.
Waiting Time: The total amount of time a process spends waiting in the ready queue. The
scheduler aims to minimize this.
Response Time: For interactive systems, this is the time from a request's submission until the
first response is produced. A good scheduler minimizes response time to make the system feel
fast and responsive to the user.
Types of Scheduling Algorithms
There are many different scheduling algorithms, each with its own advantages and disadvantages. They
can be broadly classified into two categories:
Non-Preemptive Scheduling
In non-preemptive scheduling, a process holds the CPU until it either completes its task or voluntarily
enters a waiting state. Once a process gets the CPU, it cannot be interrupted by another process.
First-Come, First-Served (FCFS): Processes are executed in the order they arrive in the ready
queue. It's simple but can lead to a long average waiting time if a long process arrives before a
short one.
Shortest Job First (SJF): The process with the shortest execution time is selected next. This is
optimal for minimizing average waiting time but requires knowing the execution time in
advance, which is not always possible.
Preemptive Scheduling
In preemptive scheduling, the CPU can be taken away from a running process and allocated to another.
This is often done when a higher-priority process arrives or when a time quantum expires. Most modern
operating systems use preemptive scheduling.
Round Robin (RR): Each process is given a small, fixed amount of time called a time quantum or
time slice. When a process's quantum expires, it is preempted and moved to the back of the
ready queue. This provides fairness and is well-suited for time-sharing systems.
Priority-Based Scheduling: Each process is assigned a priority, and the scheduler always selects
the process with the highest priority to run. To prevent low-priority processes from starving,
aging can be used, which gradually increases the priority of a process that has been waiting for a
long time.
Shortest Remaining Time First (SRTF): This is the preemptive version of SJF. The scheduler
always chooses the process with the shortest remaining execution time. It is highly efficient but
can cause starvation for longer processes.
Multilevel Queue Scheduling/feeedback: The ready queue is divided into multiple queues, each
with its own scheduling algorithm. For example, a system process queue might have a higher
priority and use a preemptive algorithm, while a user process queue might have a lower priority
and use a round-robin algorithm.
A file system is the method and data structure an operating system uses to control how data is stored
and retrieved on a storage device, such as a hard disk drive, solid-state drive, or flash memory. Without a
file system, all data would be a single, unstructured block, making it impossible to find and manage
individual files.
Key Functions of a File System
Organizing Files: File systems arrange files and directories (folders) in a logical, hierarchical
structure, similar to a tree. This allows users to easily navigate, store, and locate their data.
Managing Metadata: It stores essential information about each file, known as metadata. This
includes the file's name, size, creation date, modification date, and permissions.
Allocating Storage Space: The file system manages disk space by keeping track of which clusters
or blocks are free and which are allocated to files. This prevents files from overwriting each
other and ensures efficient use of the storage device.
Providing Data Integrity: File systems include mechanisms to protect data from corruption and
ensure consistency. Features like journaling help to recover from system crashes without losing
data.
Controlling Access: It provides security by managing user permissions and access control lists
(ACLs), which define who can read, write, or execute a file.
Common Types of File Systems
Different operating systems use different file systems. Here are some of the most common ones:
FAT (File Allocation Table): One of the oldest and simplest file systems, used primarily for flash
memory cards and external drives. It's widely compatible but lacks advanced features like
security and journaling.
NTFS (New Technology File System): The standard file system for Windows. It's robust and
includes advanced features such as security permissions, journaling (for data recovery), and
support for very large files and partitions.
ext4 (Fourth Extended File System): The default file system for many Linux distributions. It's
known for its reliability and performance, and it includes features like journaling and support for
large file sizes.
APFS (Apple File System): The default file system for modern Apple products, including macOS,
iOS, and tvOS. It's optimized for flash and solid-state storage, offering strong encryption,
snapshots, and space sharing.
HFS+ (Hierarchical File System Plus): The predecessor to APFS, used by older macOS versions.
It's still compatible with modern Macs but lacks the performance optimizations of APFS.