Module 1
Module 1
A program that acts as an intermediary between a user of a computer and the computer
hardware. An operating System is a collection of system programs that together control the
operations of a computer system.
Some examples of operating systems are UNIX, Mach, MS-DOS, MS-Windows, Windows/NT,
Chicago, OS/2, MacOS, VMS, MVS, and VM.
At the bottom, we have the computer hardware – this includes all the physical parts like
CPU, memory, and hard disk.
Above the hardware, we have the Operating System (OS). The OS is like a manager that
controls and coordinates how the hardware works and how users can use it.
Above the OS, we see the System and Application Programs – like compilers, assemblers,
text editors, and database systems. These are the programs we use to perform tasks (like
writing code, editing text, managing data, etc.). These programs run with the help of the OS,
which allows them to use hardware like memory or CPU.
At the top, we see the users (User 1, User 2, User 3, ... User n). These are the people using
the computer. Users interact with the system through the application programs, and
everything they do goes through the OS to the hardware.
Operating System Definitions
Control program – controls the execution of user programs and operations of I/O devices .
Kernel – The one program running at all times (all else being application programs).
(1) Kernel is an active part of an OS i.e., it is the part of OS running at all times. It is a programs which
can interact with the hardware. Ex: Device driver, dll files, system files etc.
(2) Shell is called as the command interpreter. It is a set of programs used to interact with the
application programs. It is responsible for execution of instructions given to Operating System (called
commands).
Operating systems can be explored from two viewpoints: the user and the system.
1. User View - From the user's side, the Operating System makes the computer easy to use. It gives a
friendly interface where users can open apps, create files, browse the internet, and play games. The
user doesn’t need to know how the computer works inside – they just click and use.
Example: When you turn on your laptop and open MS Word to type an assignment, you are using the
computer from a user’s view. The OS makes it simple for you to interact without worrying about
memory or hardware.
2. System view - From the system’s side (like the OS or hardware), the Operating System acts as a
resource manager. It manages CPU time, memory space, input/output devices, and files so that
everything runs smoothly and efficiently.
Example: When many programs are open at once, the OS decides which program gets how much
memory or which task the CPU should handle first. This is the system view, where the OS takes care of
everything behind the scenes.
An operating system (OS) is software that manages computer hardware and software resources. It acts
as a bridge between users and the computer, ensuring smooth operation.
A Batch Operating System is designed to handle large groups of similar jobs efficiently.
It does not interact with the computer directly but instead processes jobs that are grouped
by an operator.
These jobs are queued and executed one after the other, without user interaction during the
process.
1. Efficient Job Management: Multiple users can efficiently share the system, making it cost-
effective.
2. Minimal Idle Time: The system minimizes idle time by processing jobs in a continuous
sequence without human intervention.
3. Handling Repetitive Tasks: Ideal for managing large, repetitive tasks, such as payroll and
billing, with minimal effort.
4. Improved Throughput: Batch systems can handle high volumes of jobs at once, improving
overall system throughput.
1. Inefficient CPU Utilization: When a job is waiting for input/output (I/O), the CPU remains idle,
leading to poor utilization of resources.
2. Unpredictable Job Completion: If one job fails, others may be delayed indefinitely, making job
completion time unpredictable.
3. Lack of Real-Time Feedback: Users cannot interact with the system in real-time, making it less
suitable for interactive tasks.
1. CPU is better utilized and the overall performance of the system improves.
2. It helps in reducing the response time.
Advantages of Time-Sharing OS
4. Resource Sharing: Time-sharing systems allow multiple users to share hardware resources
such as the CPU, memory and peripherals, reducing the cost of hardware and increasing
efficiency.
Disadvantages of Time-Sharing OS
1. Reliability problem.
2. One must take care of the security and integrity of user programs and data.
Multiprocessor operating systems are also known as parallel Operating System or tightly
coupled Operating System.
Such operating systems have more than one processor in close communication that sharing
the computer bus, the clock and sometimes memory and peripheral devices.
It executes multiple jobs at same time and makes the processing faster.
All CPUs access the same memory, which makes communication between them easier.
If one processor fails, others can take over its work. So, the system doesn’t crash easily
Advantages of a Multi-Processing Operating System
2. As it has several processors, so, if one processor fails, we can proceed with another processor.
1. Symmetric Multiprocessing (SMP): All processors are equal and share work equally.
2. Asymmetric Multiprocessing (AMP): One main processor controls others; the rest follow its
instructions.
1. Failure of one will not affect the other network communication, as all systems are independent
of each other.
2. Since resources are being shared, computation is highly fast and durable.
2. These types of systems are not readily available as they are very expensive.
6. Real-time Sytem
A Real-Time Operating System (RTOS) is a special type of operating system designed to process
data and give results within a fixed time limit.
It is used in systems where quick and timely responses are very important, such as in medical
devices, airbag systems in cars, industrial machines, or air traffic control. An RTOS ensures that
tasks are completed on time, making the system reliable and predictable.
2. High Reliability: It performs tasks on time without delays, making it very dependable.
3. Efficient Resource Use: It manages CPU, memory, and other resources efficiently.
1. Complex Design: Real Time Operating System is harder to design and develop than regular
operating systems.
An Operating System (OS) is system software that controls and manages computer hardware and
software. It acts like a bridge between the user and the computer hardware. The structure of an
operating system means how the different parts or components of the OS are arranged and how they
interact with each other to manage all tasks in a computer system.
To make this possible, the OS is designed in a structured way. There are several common types of OS
structures:
In this structure, all parts of the OS are combined together in one large program.
All functionalities like file system, memory management, process management, etc., are
included in a single block.
Example: MS-DOS.
The OS is divided into layers, where each layer performs a specific function.
Each layer only communicates with the layer directly above or below it.
The bottom layer interacts with hardware; the top layer interacts with user programs.
3. Microkernel Structure
Only essential functions like communication between processes, memory, and basic
scheduling are kept in the kernel.
Other services like device drivers and file systems are kept outside the kernel as user-level
programs.
4. Modular Structure
Operating System is divided into separate modules, each responsible for a specific task.
Example: Linux.
The Operating System provides an interface that looks like a real machine to the user or other
programs.
The structure of an operating system is important for its efficiency, security, and flexibility. A well-
organized structure makes it easier for the OS to manage system resources, run multiple tasks at the
same time, and handle errors or updates.
The Operating System structure is designed to manage various tasks such as running programs,
managing memory, handling input/output (I/O) devices, and more. One important part of this
structure is multiprogramming.
Memory Management: Only a subset of all programs (jobs) are kept in memory at one time. When
there is not enough memory to fit all the jobs, the Operating System uses swapping, where it moves
programs in and out of memory.
The OS may also use virtual memory, which allows programs to run even if they are not completely
loaded into physical memory.
This is done by the Memory Management Unit of the Operating System.
Processes and Scheduling: Each user has at least one process (program in execution) in memory. When
multiple processes are ready, the CPU scheduler decides which one to run next.
These are managed by the Process Scheduler and Dispatcher in the Operating System structure.
Operating System (Core): The Operating System itself stays in a protected part of memory (usually
starting from address 0). It controls all hardware and software, loads programs from disk, manages
switching between them, and keeps everything working smoothly.
Computer System Organization in Operating Systems refers to how the different parts of a
computer work together to run programs and perform tasks.
There are 3 categories in Computer System Organization:
2. Storage Structure
3. I/O Structure
All major components are connected and managed through a central communication path
called a system bus.
At the center is the CPU (Central Processing Unit), which controls and coordinates all
activities. The memory (RAM) is directly connected to the bus and stores data and
instructions currently being used.
For storage purposes, disks like hard drives are connected through a disk controller, which
manages how data is read from or written to them.
Input and output devices such as the mouse, keyboard, and printer are connected via a
USB controller, which helps these devices communicate with the rest of the system.
The graphics adapter handles visual output and connects the monitor, allowing the system
to display information.
This organized structure helps the operating system manage resources effectively,
ensuring smooth and efficient performance of the computer.
The CPU operates in two main stages: user process execution and I/O interrupt processing.
On the other hand, the I/O device has two stages as well: idle and transferring.
Initially, the CPU is busy executing user processes while the I/O device remains idle. When the
I/O device begins transferring data, it eventually completes its task and sends an interrupt
signal to the CPU.
Upon receiving the interrupt, the CPU pauses user process execution and enters the I/O
interrupt processing phase to handle the request.
After processing the interrupt, the CPU resumes its user-level tasks.
This timeline shows how interrupt-driven I/O allows efficient communication and coordination
between the CPU and peripheral devices without wasting CPU time during device data
1transfers.
2. Storage Structure
2. Secondary Memory
3. Cache Memory
Main Memory: Main memory holds the data and instructions that are currently needed
by the CPU for processing.
Example: RAM (Random Access Memory)RAM is volatile, which means data is lost when
the power is turned off.
Secondary Memory: Secondary memory is used to store data permanently. It is especially
useful for backup and long-term storage.
Examples: Hard disk, ROM (Read-Only Memory). The operating system is responsible for
transferring data from secondary memory to main memory when required.
Cache Memory: Cache memory is a very high-speed memory and is smaller in size
compared to other types of memory. It stores frequently accessed data and instructions
to speed up processing by the CPU.
3. 2I/O Structure
Input/Output (I/O) operations are handled in a computer system using device controllers and
device drivers.
Device controller is a small part of the hardware that manages a specific device (like a
keyboard, mouse, or disk).
Each device has its own controller, and the operating system uses a device driver to talk to it.
The driver understands how to control the device and provides a standard way for the
operating system to use it.
When the system wants to perform an I/O task (like reading from the keyboard), the device
driver sends instructions to the device controller. The controller then moves the data to its
local buffer.
Once done, it signals the driver (using an interrupt) that the task is complete. The driver then
gives the data to the operating system or tells it that the operation is done.
For small data, this method works well, but it becomes slow for large data like copying big files.
With DMA, the controller sends large blocks of data directly to or from the system memory
without needing the CPU's help.
This saves time and allows the CPU to do other tasks while the data transfer happens in the
background.
Computer-System Architecture
The CPU (Central Processing Unit) is the brain of the computer. It performs calculations, makes
decisions, and runs instructions. Modern CPUs have multiple cores (like mini-CPUs) that
handle different tasks at the same time for better performance.
Next to the CPU is the cache, a very fast memory that stores frequently used data. This helps
the CPU work faster by reducing the time needed to access the main memory (RAM).
The instruction cycle is a repeated process where the CPU fetches, decodes, and executes
instructions. This cycle happens billions of times per second.
RAM (main memory) is a temporary storage area that holds data and instructions while the
computer is working. The CPU constantly reads from and writes to RAM while processing tasks.
External devices like keyboards, printers, and hard drives are connected to the CPU. These use
I/O (Input/Output) operations to send or receive data. When a device needs the CPU’s
attention, it sends an interrupt—for example, when you press a key.
Some devices use DMA (Direct Memory Access) to directly transfer data between memory and
the device without involving the CPU. This makes the system faster and frees up the CPU for
other tasks.
1. Single-Processor Systems
A single-processor system has only one main CPU that performs all the major tasks like running
programs and executing instructions.
Even though there is only one main processor, the system can still have other special-purpose
processors. These are small processors built into devices like keyboards, disks, or graphics
cards to help with specific tasks.
These special-purpose processors do not run user programs. Instead, they perform simple,
dedicated tasks, and sometimes the operating system controls them.
For example, a disk controller may have its own mini processor to manage how files are read
from or written to the disk, which reduces the burden on the main CPU. Similarly, a keyboard
may have a tiny processor that changes key presses into signals the CPU can understand.
2. Multiprocessor Systems
A multiprocessor system has two or more processors (CPUs) that work together and share
the same memory and devices. These systems are also called parallel systems or multicore
systems, and they are common in modern computers, including desktops, laptops, servers,
and even smartphones.
1. Increased Throughput – Since there are multiple processors, more tasks can be done at
the same time, so the system becomes faster.
2. Economy of Scale – Using one multiprocessor system is often cheaper than using several
separate single-processor systems. This is because multiple processors can share the same
devices, like storage and power, which saves cost and space.
3. Increased Reliability – If one processor fails, the system does not completely stop. The
other processors can take over the work. For example, if 1 out of 10 processors fails, the
system may only slow down a little but will still keep working.
3. Clustered System
These nodes can be single or multi-core systems and are usually connected over a network like
LAN.
Clustered systems are known as loosely coupled because each node runs independently but
shares resources like storage.
If one computer fails, another one in the cluster can take over and continue the work without
much delay. This is managed using special software that monitors each node.
Asymmetric Clustering – One machine does the work while another stays in hot-standby mode
(just watching). If the active one fails, the standby becomes active.
Symmetric Clustering – All machines are active, running applications and watching each other.
This is more efficient since all machines are used.
Clustered systems are also used for high-performance computing, where tasks are divided
among multiple computers to be completed faster. This is called parallelization. For example,
a weather forecasting system may divide the prediction task into parts, process each on a
different node, and then combine the results.
Operating System Services
An Operating System provides a set of services that make it easier for users and applications to use the
computer hardware effectively. These services help manage system resources and ensure smooth
operation. Here are the main services provided by an OS:
1. Program Execution
The OS loads programs from storage into main memory and starts their execution. It also manages
program execution by handling process creation, scheduling, and termination.
Example: Running a C++ program that was saved on the hard disk after compilation.
2. I/O Operations
When a program needs to read or write data from/to I/O devices (like a keyboard, printer, or file), the
OS provides the necessary support and permissions to access and control these devices.
The OS manages files on different storage devices. It allows users and programs to create, delete, read,
write, and execute files. It also handles directory structures and file permissions.
Example: Creating a new text file, opening it, editing it, and saving it.
4. Communication
Example: A client-server application where the client sends a request and the server responds.
Errors can occur in hardware or software. The OS is responsible for identifying these errors and taking
corrective actions to maintain system stability.
Example: Detecting a memory access violation and terminating the faulty process.
6. Resource Allocation
Resources such as CPU time, memory space, and I/O devices are allocated to multiple users or jobs.
The OS ensures fair and efficient resource distribution based on priority, need, and availability.
7. Accounting
The OS maintains logs of how much and what type of resources are used. This is useful for billing (in
shared systems), monitoring, or improving system performance.
Protection refers to the control of access to resources by processes. Security ensures that external
threats do not breach the system. The OS enforces access controls and authentication to maintain data
integrity.
System Components
System components refer to the essential parts of an operating system that help it manage hardware
and software resources.
These components work together to make the system function smoothly and allow users and
applications to interact with the hardware efficiently.
1. Process Management - Handles the creation, scheduling, and termination of processes. Manages
CPU time among processes. Example: Switching between apps on your phone.
2. Memory Management - Manages the main memory (RAM). Keeps track of which part of memory is
in use and by whom. Loads programs into memory and removes them when done.
3. File System Management - Controls how data is stored and retrieved. Manages files and directories
on storage devices. Handles permissions and file access.
4. Storage Management - Handles reading/writing to secondary storage (hard disk, SSD). Keeps track
of data location, storage space, and backups.
5. Security and Protection - Protects data and resources from unauthorized access. Provides user
authentication, permissions, and encryption.
6. User Interface (UI) - Interface through which users interact with the OS. Can be Command Line
Interface (CLI) or Graphical User Interface (GUI).
System Call
A system call is a programmatic way in which a computer program requests a service from the kernel
of the operating system on which it is executed. A system call is a way for programs to interact with
the operating system. A computer program makes a system call when it requests the operating
system's kernel.
Types of system calls:
1. Process Control
This service helps the OS manage processes, which are programs that are currently running. Every
time you open a program like a browser or a text editor, a process is created. The OS controls when
the process starts, runs, pauses, or ends.
wait() – Makes one process wait until another finishes (useful for background tasks).
Example: When you click on Chrome, the OS creates and loads it into memory and then executes it as
a process.
2. File Management
The OS helps users and programs to work with files and folders (also called directories). It keeps track
of where files are stored, how they are named, and who can access them.
Example: When you save a document in Word, the OS writes the data into a file and saves it to your
disk.
3. Device Management
This service helps the OS manage all input and output (I/O) devices like keyboards, printers, monitors,
and USBs. The OS handles requests from programs to use these devices and controls access to them.
4. Information Maintenance
This service allows the OS to keep track of system information like date, time, and system health. It
helps in updating or retrieving information that is useful for both the user and the system.
set_time() – Changes the system time (like when you manually set the clock).
get_system_info() – Provides details like memory usage, system version, or CPU information.
Example: When you check the system settings to see how much storage or memory is used, this service
is working.
5. Communication
This service allows different processes or programs to talk to each other, even if they are on different
computers. This is called Inter-Process Communication (IPC).
Example: When you're on a video call, your app is sending and receiving data through communication
services, often using IPC in the background.
System Programs
System programs, also known as system utilities, provide a convenient environment for program
development and execution. Some of them are simply user interfaces to system calls. Others are
considerably more complex. They can be divided into these categories:
[Link] management – These programs create, delete, copy, rename, print, dump, list, and generally
manipulate files and directories.
[Link] information – Some programs simply ask the system for the date, time, amount of available
memory or disk space, number of users, or similar status information.
[Link] modification - Several text editors may be available to create and modify the content of files
stored on disk or other storage devices.
5. Program loading and execution - Once a program is assembled or com piled, it must be loaded into
memory to be executed. The system may provide absolute loaders, relocatable loaders, linkage editors,
and overlay loaders. Debugging systems for either higher-level languages or machine language are
needed as well.
6. Communications – These programs provide the mechanism for creating virtual connections among
processes, users, and computer systems. They allow users to send messages to one another’s screens,
to browse Web pages, to send e-mail messages, to log in remotely.
7. Background services - Some of these processes terminate after completing their tasks, while others
continue to run until the system is halted. Constantly running system-program processes are known as
services, subsystems, or daemons.