OPERATING SYSTEMS [EIT]
Module 2 [Chapter 1]
OPERATING SYSTEMS
Operating System: An O.S is a system software that acts as an interface between the user
and the computer hardware.
It manages the hardware resources & provides services for computer programs.
Definition: The O.S is a program that manages the computer hardware & software resources
& provides a platform for application programs to run.
Ex: Windows, MacOS, Linux, Android etc.
The History of Operating System
• Early Computers were large and inefficient, occupying entire rooms.
• Program execution required manual setup: mounting tapes, inserting punched cards,
setting switches, etc.
• Each program (called a job) was run separately - no multitasking.
• Users booked time slots to use the machine and had full control during that time.
Beginning of O.S
• Operating systems first emerged to simplify program setup and manage transitions
between jobs.
• A computer operator was introduced - users submitted their jobs and returned later for
results.
• This eliminated the need for users to physically enter the computer room.
Batch Processing Systems
• Batch processing was introduced: jobs were collected in batches and executed one by
one automatically.
• Jobs waiting for execution were placed in a job queue (usually FIFO—First In, First
Out).
• However, job priorities could modify the strict FIFO order.
• Each job included setup instructions written in JCL (Job Control Language).
• These instructions told the operating system how to prepare for that job.
• Early communication between the operator and OS used printed messages — an early
form of system feedback (e.g., today’s error messages like “printer not responding”).
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 1
OPERATING SYSTEMS [EIT]
• Batch systems didn’t allow user interaction during execution.
• Interactive applications like reservation systems, word processors, and games required
real-time feedback.
Interactive Processing
• Introduced to allow real-time interaction between users and the computer via
terminals.
• Terminals were simple input/output devices (like typewriters) connected to the main
computer.
• Modern equivalents: workstations and personal computers.
• Computers needed to respond instantly to user actions or environmental events.
• Real-time processing means performing tasks within fixed deadlines (e.g., typing in a
word processor or handling live transactions).
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 2
OPERATING SYSTEMS [EIT]
Time Sharing & Multiprogramming
• To serve multiple users simultaneously, time-sharing systems were developed.
• Multiprogramming divided CPU time into small intervals, allowing multiple jobs to
run seemingly at once.
• This created the illusion of parallel execution and supported up to 30 users at once in
early systems.
• In single-user systems, this concept evolved into multitasking.
• Large central computers were connected to multiple workstations.
• Users could directly communicate with the main computer remotely.
• The role of the computer operator faded as systems became more autonomous.
• The operator role evolved into a system administrator, responsible for:
➢ Installing and maintaining software/hardware
➢ Managing user accounts and permissions
➢ Handling storage limits and troubleshooting
Modern Operating System
• Modern OSs manage time-sharing, multitasking, and mass storage efficiently.
• They directly handle user requests, execute programs, and maintain system resources.
• Newer systems use multiple processors for faster execution.
• OS must handle:
➢ Load balancing - distributing tasks evenly across processors
➢ Scaling - dividing jobs into smaller subtasks for multiple processors
Networking and Distributed Systems
• Networking led to operating systems that manage resources across multiple computers.
• These systems coordinate users, data, and processes across connected networks (basis
for cloud and distributed computing).
Embedded Operating Systems
• Found in special-purpose devices like phones, cars, appliances, and medical
equipment.
• Must be power-efficient, real-time, and reliable.
• Examples:
➢ VxWorks – used in NASA Mars Rovers (Spirit, Opportunity)
➢ Windows CE – for Pocket PCs
➢ Palm OS – for handheld devices
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 3
OPERATING SYSTEMS [EIT]
Operating System Architecture
A Software Survey
Software Classification:
• Software can be classified into different categories or types based on their purpose.
• Software on a computer is broadly divided into:
1. Application Software
2. System Software
Application Software:
• Application Software refers to computer programs that helps users perform
particular tasks or solve specific problems using computer.
• It performs user specific tasks like typing, calculating, designing etc.
• Ex: Excel Sheets, Database system, Program development tools etc.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 4
OPERATING SYSTEMS [EIT]
System Software
• System Software is a set of programs that manages and controls computer
hardware.
• It acts as the bridge between user, application, programs & hardware.
• It controls and manages hardware components like CPU, memory, I/O
devices.
• It provides platform/infrastructure for application software to run.
• It coordinates communication between software and hardware.
Categories of System Software
1. Operating System (OS)
2. Utility Software
Utility Software:
• Utility programs perform basic but essential tasks not built directly into
the OS.
• Examples:
➢ Disk formatting
➢ File copying or backup
➢ Data compression/decompression (e.g., ZIP files)
➢ Media players
➢ Network management tools
• These help customize the computer system for specific needs.
• It allows users or companies to adapt system functions without changing the
OS itself.
• Utilities can be modified or replaced more easily than the core OS.
• The line between application software and utility software is often unclear.
• A program may start as an application but later become a utility as it becomes
more essential.
• Similarly, the boundary between the operating system and utility software is
not always clear.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 5
OPERATING SYSTEMS [EIT]
Operating Systems:
Operating Systems manages hardware, memory, and basic system operations.
An Operating System (OS) is broadly divided into two main parts:
1. User Interface
2. Kernel
Components of Operating System
1) USER INTERFACE
• The user interface is the part of the operating system that allows the user to
interact with the computer system.
• It acts as a bridge between the user and the hardware by accepting commands
from the user and displaying the results.
Types of User Interface
1. Text-based Interface (Shells):
• It is old style, where commands are typed using a keyboard.
• It uses CLI (command line interface) to write commands and execute them.
• Ex: UNIX Shell, MS- DOS, cmd shell
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 6
OPERATING SYSTEMS [EIT]
2. Graphical User Interface (GUI):
• It is a system software for interacting with electronic devices through visual
elements like button, menus etc
• Modern systems use icons, windows, and menus to represent files and
programs.
• Commands are given using devices like a mouse, stylus, or touchscreen.
• Ex: Windows, macOS, Linux GUIs (like KDE, GNOME).
3. 3D Interfaces:
• It is an advanced form of UI that allows users to interact with computers in a
3-D environment.
• Current research includes 3D projection systems, tactile feedback, and
surround sound for immersive interaction.
Window Manager
• A window manager controls and organizes the visual layout on the screen.
• It divides the screen into windows for different applications.
• Keeps track of which app owns which window.
• Handles mouse actions (e.g., clicks, drags).
• Determines the style or theme of the GUI (look and feel).
• Example: KDE and GNOME are popular window managers in Linux.
2) KERNEL
• It is the heart of the OS, it manages hardware, memory, files and processes.
• The kernel is the core part of the OS that directly interacts with the
computer hardware.
• It performs all low-level tasks like managing memory, CPU & I/O devices.
1. File Manager
• Manages all files and directories stored on disks.
• Keeps track of:
➢ File names, locations, and permissions.
➢ Free space available for new files.
• Allows organization of files using:
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 7
OPERATING SYSTEMS [EIT]
➢ Directories (Folders) – to group related files.
➢ Subdirectories – directories inside other directories.
➢ Example Path: UNIX/Linux: animals/prehistoric/dinosaurs
Windows: animals\prehistoric\dinosaurs
2. Device Drivers
• These are the software units that control and communicate with hardware
devices.
• Each driver is specific to a particular device (e.g., printer, disk drive,
monitor).
• They translate general OS requests into device-specific commands.
• Example: A printer driver handles all technical details of printing.
• Advantage: The OS can support many devices easily - just install the
appropriate driver.
3. Memory Manager
• Manages the use of main memory (RAM) by programs.
• Responsibilities include:
➢ Allocating memory to processes.
➢ Preventing one program from interfering with another’s memory.
➢ Reclaiming memory after a program finishes.
• In multitasking or multiuser systems, this becomes complex because
multiple programs share memory.
Virtual Memory (Paging):
• When programs need more memory than available, the OS uses a part of the
hard disk as temporary memory.
• Example:
➢ System has only 4 GB RAM but needs 8 GB total.
➢ The OS uses 4 GB of disk space as virtual memory.
• Memory is divided into pages, which are swapped between RAM and disk
as needed. This technique is called paging.
• It creates the illusion of having more memory than physically exists.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 8
OPERATING SYSTEMS [EIT]
• Scheduler and Dispatcher handles CPU process management.
• Scheduler: Decides which processes should run next.
• Dispatcher: Allocates CPU time to those processes.
Bootstrapping/ Booting
• Bootstrapping (or booting) is the process of starting a computer and loading the
operating system (OS) into main memory from secondary storage (like a hard disk or
flash memory).
• It happens automatically each time the computer is powered on.
Why Bootstrapping Is Needed
➢ When the computer is turned off, main memory (RAM) loses all its data because it
is volatile.
➢ When the computer turns on, main memory is empty, so we need a small program
to load the OS into it.
➢ This is where the bootstrapping process helps — it brings the OS into memory to
start the system.
• Every CPU has a program counter that starts at a predetermined memory address
when the machine is powered on.
• The CPU expects to find the first instruction of a program (the boot program) at this
address.
• The boot program is stored in a non-volatile memory area called ROM (Read-Only
Memory) so that it is not erased when the computer is off.
• ROM contains permanent startup instructions, known as firmware.
• Modern systems use flash memory instead of traditional ROM so updates are
possible.
• The boot loader is a small program permanently stored in ROM or firmware.
• Boot loader program job is to:
1. Locate the operating system in mass storage (like HDD, SSD, or network).
2. Load (copy) the OS into the main memory (RAM).
3. Start (jump to) the OS program in memory.
• The OS may be copied from:
1. A hard disk or SSD (common in desktops/laptops).
2. Flash memory (used in smartphones and embedded systems).
3. A network server (used in offices, universities).
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 9
OPERATING SYSTEMS [EIT]
• Once the OS is loaded into main memory,
➢ The boot loader executes a jump instruction to the OS start address.
➢ The OS takes control and begins managing the computer’s resources.
• The boot loader and firmware can sometimes be updated — this is called a firmware
update.
• But still, the full OS is usually stored on mass storage, not ROM.
Overall Process of Using the Computer
1. Turn on the computer.
2. The boot loader (in ROM) runs automatically.
3. It loads the OS from disk or network into main memory.
4. The OS starts running and controls the computer.
5. The user interacts with the OS to open utility or application programs.
6. After finishing, control returns to the OS, ready for new tasks.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 10
OPERATING SYSTEMS [EIT]
Coordinating the Machine’s Activities
Concept of a Process
• A program is a static set of instructions stored in memory.
• A process is the dynamic execution of that program — it represents the program in
action.
• The process state includes:
➢ The program counter (showing which instruction is being executed),
➢ The CPU register values.
➢ The memory cells used by the process.
• The process state acts like a snapshot of the computer’s condition at a given time.
• Modern systems often run multiple processes simultaneously (multitasking/time-
sharing).
• The operating system (OS) manages these processes — allocating resources,
preventing interference, and enabling communication between them.
Process Administration
• The kernel (core part of the OS) manages process coordination using two key
components:
(a) Scheduler and (b) Dispatcher.
Role of the Scheduler:
➢ Keeps track of all processes in the system.
➢ Adds new processes when a program starts and removes completed ones.
➢ Maintains a process table, which stores information for each process, such as:
✓ Memory space allocated,
✓ Process priority, and
✓ Current state (ready or waiting).
➢ Ready state: Process can continue execution.
➢ Waiting state: Process is paused, waiting for an event (e.g., I/O completion,
keyboard input, or message arrival).
Role of the Dispatcher:
➢ Oversees the execution of processes scheduled by the scheduler.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 11
OPERATING SYSTEMS [EIT]
➢ Implements multiprogramming, dividing CPU time into small units called time
slices (milliseconds or microseconds).
➢ Switches between processes so that each gets CPU time — this is called a process
switch or context switch.
• Each time a process is given a time slice, the dispatcher starts a timer circuit.
• When the time slice ends, the timer sends an interrupt signal to the CPU.
• Upon receiving the interrupt:
➢ The CPU saves the current process state (program counter, registers, etc.).
➢ Executes an interrupt handler — a routine that tells the dispatcher what to do
next.
• The dispatcher then:
➢ Chooses the next ready process with the highest priority.
➢ Reloads its saved state.
➢ Restarts the timer and gives it CPU control.
• CPUs designed for multiprogramming automatically support:
➢ Saving a process state when interrupted.
➢ Restoring it later to resume from the same point.
• This makes process switching fast and efficient.
• Without multiprogramming, the CPU stays idle while one process waits for I/O or user
input.
• With multiprogramming:
➢ When one process waits (e.g., for disk I/O), the CPU switches to another ready
process.
➢ Thus, no CPU time is wasted — other processes make progress.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 12
OPERATING SYSTEMS [EIT]
Handling Competition Among Processes
• The operating system (OS) is responsible for allocating machine resources (like CPU
time, memory, files, and devices) to processes.
• The OS must use careful algorithms to allocate resources reliably and avoid errors.
• Controlled Resource Allocation
➢ Multiple processes may need the same resource (e.g., a printer).
➢ If two processes use the printer simultaneously, the output becomes
meaningless.
➢ Therefore, the OS must decide which process gets access and make others
wait.
• A flag (bit in memory) can represent whether a resource is free or busy.
➢ Flag = 0 (clear) → resource is available.
➢ Flag = 1 (set) → resource is in use.
• When a process requests a resource:
1. OS checks the flag.
2. If clear → resource granted; OS sets the flag.
3. If set → process is made to wait.
• After use, the OS clears the flag or assigns the resource to a waiting process.
• Checking and setting the flag require multiple instructions.
• A process might be interrupted between checking and setting the flag.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 13
OPERATING SYSTEMS [EIT]
• This could cause two processes to believe the resource is free and both use it —
leading to resource conflict.
Solutions to Prevent Interruptions
a) Disabling Interrupts
• Use interrupt disable and interrupt enable instructions.
• During flag checking and setting:
➢ Interrupts are disabled to prevent any other process from running.
➢ After completing the operation, interrupts are enabled again.
b) Test-and-Set Instruction
• A single machine instruction that:
1. Checks the flag.
2. Notes its value.
3. Sets the flag — all in one step.
• Prevents interruption because a single instruction executes completely
before the CPU accepts another interrupt.
Semaphore:
➢ A semaphore is a properly implemented flag used for resource control.
➢ Works like a railway signal — allowing only one train (process) on a track (critical
section) at a time.
• Critical Region: part of a program that accesses a shared resource.
• Mutual Exclusion: only one process is allowed to execute a critical region at any time.
• The semaphore ensures mutual exclusion:
1. Process checks if semaphore is clear → sets it → enters critical region.
2. When done → clears the semaphore → allows another process to enter.
Deadlock:
A situation where two or more processes are waiting for each other indefinitely because each
holds a resource the other needs.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 14
OPERATING SYSTEMS [EIT]
Example:
• Process A has the printer and wants the CD drive.
• Process B has the CD drive and wants the printer.
• Both are waiting forever → deadlock.
Conditions for Deadlock
Deadlock occurs only if all three conditions exist:
1. Competition for non-sharable resources (resources can’t be shared
simultaneously).
2. Partial allocation (process holds some resources and requests more).
3. No preemption (resources cannot be forcibly taken away).
Methods to Handle Deadlock
a) Deadlock Detection and Correction
• Allow deadlock to occur, then detect and fix it.
• Fixing usually means terminating (killing) some processes to free resources.
• Used when deadlocks are rare.
b) Deadlock Avoidance: Prevent deadlocks by removing one of the three
conditions.
Spooling
• Definition: Storing data temporarily in mass storage to be printed later.
• Benefit: Makes a non-sharable device (like a printer) behave as if it’s sharable.
• Used for smoother handling of competing processes.
Security
• The operating system (OS) plays a vital role in maintaining security and reliability.
• If there are flaws (e.g., file loss due to a bug in the file manager or a system crash),
user data becomes insecure.
• Hence, a dependable and well-designed OS is essential for computer security.
• Software Reliability: Reliability issues are part of software engineering, not just
operating systems. However, here we focus on security problems specific to operating
systems.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 15
OPERATING SYSTEMS [EIT]
A) Attacks from the Outside:
• User Accounts:
OS protects resources by creating user accounts with names, passwords, and
privileges.
• Administrator (Super User):
Has special rights to manage users, software, and monitor system activity.
• Auditing Software:
Tracks user activities and detects suspicious actions like failed logins or abnormal
usage.
• Sniffing & Fake Logins:
Some programs trick users into entering their passwords or secretly record activities.
• User Carelessness:
Weak passwords, sharing credentials, and using unapproved software reduce system
security.
→ Organizations enforce password and usage policies.
B) Attacks from Within:
• Internal Threats:
Malicious users or intruders may try to access restricted files or memory.
• Memory Protection:
CPU uses special registers to restrict each process to its assigned memory area.
• Privilege Levels
➢ Privileged mode: OS can run all the instructions.
➢ Non-privileged mode: User programs have the limited access.
• Unauthorized privileged actions cause interrupts and return control to the OS.
• Importance:
If privilege control fails, a process can misuse CPU time, access files, or modify
memory.
Prepared by Anusha A N, Dept of AIML, GMIT, Davangere 16