1
Unit 4 Operating System
Operating System (OS)
An Operating System is system software that acts as a link between the user and the
computer hardware. It manages and allocates resources to running programs and provides
a platform for applications to run.
Examples: Windows, Linux, macOS, Android, iOS
Objectives of Operating System
1. Convenience: Operating system makes the computer easier to use by providing a user-
friendly interface and handling complex hardware operations in the background.
2. Efficiency: Operating system manages hardware and software resources effectively to
ensure smooth and optimal performance.
Disk Operating System (DOS)
DOS is an early operating system that uses a Command-Line Interface (CLI), where users
type commands to interact with the computer and perform tasks. It is called a Disk Operating
System because it was originally stored on a floppy disk. DOS was widely used but was later
replaced by graphical operating systems, such as Windows.
Windows
Windows is the most commonly used operating system for desktop and laptop computers,
developed by Microsoft. It provides a user-friendly Graphical User Interface (GUI), where
users interact with the computer using windows, icons, menus, and a pointer. Some popular
versions include Windows XP, Windows 7, Windows 10, and Windows 11.
Macintosh Operating System (macOS)
macOS is an operating system developed by Apple for its Macintosh (Mac) computers. It
provides a graphical user interface (GUI) and is known for its simplicity, security, and smooth
performance. Some popular versions of macOS include Catalina, Big Sur, Monterey, Ventura,
and Sonoma.
2
Linux
Linux is a free and open-source operating system based on UNIX. It is highly customizable,
secure, stable, and resource-efficient. It is widely used on servers, embedded systems, and
mobile devices, and is also used on laptop and desktop computers. Some popular Linux
versions (called distributions) include Ubuntu, Fedora, Debian, and CentOS.
Unix
Unix is a powerful, multiuser, multitasking operating system originally developed at Bell
Labs. It is known for its stability, security, and portability, which is why its variants are still
used in some servers, workstations, and mainframe computers. Many modern operating
systems, including Linux and macOS, are based on UNIX principles.
Features of Operating System
1. Batch Processing
In batch processing, similar jobs are grouped together to form a batch. The operating system
executes the jobs in a batch one after another on the CPU without user involvement.
Example: Payroll systems where salaries are processed in bulk at the end of the month.
2. Multiprogramming
In multiprogramming, multiple programs are kept in main memory at the same time, but
only one program uses the CPU at any moment. When the current program waits for
input/output (I/O) to complete or finishes execution, the CPU switches to another program.
Example: In older computers, while one program was waiting for a document to print, the
CPU could switch to another program performing calculations.
3. Multitasking
Multitasking allows a single user to run multiple programs at the same time. The CPU
executes these programs by switching among them so fast that it looks like they run
simultaneously, even though the CPU handles one at a time.
Example: Listening to music while browsing the internet.
3
4. Time Sharing
In time sharing, multiple users share a computer at the same time, and each user gets a
small time slice of its CPU.
Example: University server where many students log in simultaneously to access study
material, submit assignments, or run programs.
5. Multiprocessing
Multiprocessing is the ability of an operating system to run multiple processes
simultaneously on multiple CPUs.
Example: A computer with two CPUs, one runs a web browser, and the other runs a music
player.
6. Parallel Processing
In parallel processing, a task is divided into smaller sub-tasks, which are processed
simultaneously by multiple processors.
Example: A supercomputer with millions of processors forecasting weather.
Distributed Operating System
Distributed operating system manages a group of independent computers and makes them
work like a single system.
Example: Cloud-based operating system that manages and coordinates multiple servers
used by Google Drive.
Embedded Operating System
An embedded operating system is designed to run on embedded devices that perform
specific functions, such as ATMs, digital camera, and smart televisions.
Booting
Booting is the process of starting a computer. During booting, the BIOS/UEFI checks the
hardware devices and then loads the operating system from the hard disk (or SSD) into the
main memory (RAM), so the CPU can run it.
4
Functions of Operating System
1. Process Management
Process management is a component of an operating system that manages the allocation of
CPU time and other resources to the processes in main memory. It also keeps track of the
state and resource ownership of each process.
2. Memory Management
Memory management is a component of an operating system that allocates memory to
processes, keeps track of used and free memory, and prevents interference between
programs.
3. File Management
File management is a component of an operating system that stores, organizes, and
manages files and folders on storage devices such as hard disks, SSDs and USB drives. It
allows users to create, read, write, rename, and delete files and folders.
4. I/O System Management
I/O system management is a component of an operating system that manages and
coordinates input/output operations between the CPU, main memory, storage devices and
I/O devices during program execution.
5. Secondary Storage Management
Secondary storage management is a component of an operating system that manages free
space and storage allocation on secondary storage devices such as hard disk and SSD.
6. Network Management
Network management is a component of an operating system that manages network
connections, shares resources among computers, assigns privileges, and monitors network
performance and problems.
5
7. Protection System
The protection system is a component of an operating system that ensures each resource is
used only according to the assigned privileges and prevents unauthorized access and misuse
of data and resources.
Command Interpreter
A command interpreter (also called a shell) is a component of an operating system that
provides an interface and allows users to interact with the computer by typing commands.
It reads and interprets these commands and passes them to the operating system for
execution.
Examples: Command Prompt in Windows, bash, sh, or zsh in UNIX/Linux.
Process
A process is an instance of a program in execution. It includes the program code, the current
activity (such as values in CPU registers), allocated resources like memory and files, and all
necessary information for proper execution.
Example: When we open MS Word, a process is created as it begins executing and starts
using CPU, memory, and file resources.
Process States
1. New State
A process is in the New state when it has just been created but has not yet been admitted
into main memory (RAM) for execution.
Example: When we open MS Word, its process is created and enters the New state.
2. Ready State
A process is in the Ready state when it is ready to run but is waiting for the CPU to become
available. Multiple processes can be in the Ready state at the same time.
Example: If MS Word and Chrome are both open, but the CPU is currently running Chrome,
then MS Word is in the Ready state.
6
3. Running State
A process is in the Running state when it is actively being executed by the CPU. Only one
process per CPU core can be in the Running state at a time.
Example: If we are typing in MS Word, that process is in the Running state.
4. Waiting (or Blocked) State
A process enters the Waiting (or Blocked) state when it cannot continue until some event
occurs, such as the completion of an I/O operation.
Example: MS Word waiting for a document to finish printing is in the Waiting state.
5. Terminated State
A process enters the Terminated state after finishing its execution. The operating system
reclaims all resources that were allocated to it.
Example: When we close MS Word, the OS reclaims the CPU, memory, files, and other
resources, and the process enters the Terminated state.
Thread
A thread is a basic ordered sequence of instructions within a process that can be executed
independently. A process can contain one or more threads that share its resources, such as
memory and files.
Example: In MS Word, when you type text, one thread handles your keyboard input while
another thread checks spelling and grammar in the background at the same time.
Multithreading
Multithreading is a method of program execution in which multiple threads of a single
process run simultaneously.
The main purpose of multithreading is to enable the concurrent execution of two or more
parts of a program to utilize CPU time efficiently.
Example: In MS Word, multiple threads run at the same time — one for typing, one for spell-
checking, and another for auto-saving — all working together within the same process.