An Operating System (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. It acts as an intermediary between users and the hardware.
Example: When you open a browser, the OS allocates memory, schedules CPU time, and manages disk and network access.
Example: Early IBM mainframes processed one job after another using punch cards.
Example: While Job A is waiting for I/O, CPU can execute Job B.
Example: University computer labs with shared access terminals.
Example: Windows, macOS, Linux used on laptops/desktops.
Example: Supercomputers performing scientific simulations.
Example: Google Search infrastructure or cloud computing.
Example: Airbag control system in cars or medical devices.
Memory Management is a core function of the OS that handles how memory is allocated and accessed.
Example: Logical Address = 1000 Base = 4000 → Physical Address = 5000
Example: Process A → RAM Process B needs memory → Swap A to disk, load B into RAM.
Example: Memory = [|---P1---|---P2---| |] Each process occupies one block of continuous space.
Example: Logical Pages: 0, 1, 2 Mapped to Frames: 5, 3, 7 (non-contiguously)
Example: Code Segment: 0-999 Data Segment: 1000-1999 Stack Segment: 2000-2999
Virtual memory allows programs to use more memory than physically available by using disk as an extension.
Pages are brought into memory only when needed (on-demand).
Example: Page 4 not in memory → Page fault → OS loads Page 4 from disk.
Replaces existing pages when memory is full.
Example: Pages in RAM = [2, 3, 1] Request = Page 4 → Replace LRU (Page 2) → RAM = [4, 3, 1]
Depends on how often page faults occur. Fewer page faults = better performance.
Frames are given to processes using strategies like equal, proportional, global/local allocation.
Occurs when the system spends more time swapping pages than executing actual processes.
Example: Too many processes → Constant swapping → CPU idle.
Includes optimizations like prepaging and TLBs for faster address translation.
A process is a program in execution. It includes the program code, current activity, and process resources like registers, memory, and open files.
Example: Opening MS Word creates a process with its own memory, CPU registers, and files.
Determines the order in which processes access the CPU.
Create → Ready → Running → Waiting → Terminated
P1(5), P2(3), P3(1) → Order: P1 → P2 → P3
P3(1), P2(3), P1(5) → Order: P3 → P2 → P1
Quantum = 2ms → P1(4), P2(3), P3(2) → RR Cycle
P1(priority 1), P2(priority 2) → P1 runs first
Ensures processes don’t interfere with each other while accessing shared data.
Example: Two processes updating the same variable should not do it at the same time.
wait(S): while S <= 0 wait; S--; signal(S): S++;
A system consists of a finite number of resources to be distributed among competing processes. Resources may be preemptible or non-preemptible.
Example: Resources: R1 (Printer), R2 (Scanner) Processes: P1 and P2 both need R1 and R2 to finish.
Deadlock occurs when a group of processes are each waiting for resources held by others in the group, leading to a cycle of dependency.
Example: P1 holds R1 and waits for R2. P2 holds R2 and waits for R1 → Deadlock.
There are three general approaches:
Ensure that at least one of the necessary conditions for deadlock does not hold.
Example: Request all resources together: request(R1, R2) instead of R1 first, then R2.
Use information about future resource requests to ensure the system never enters a deadlock state.
Banker's Algorithm: Allocates resources only if it leaves the system in a safe state.
Example: If P1 needs 2 more units, but only 1 is available → Delay allocation to P1.
Allow deadlock to occur and then detect it using a resource allocation graph or wait-for graph.
Example: Cycle in wait-for graph → Deadlock is present.
Once detected, system must recover using one of the following methods:
Example: Terminate P2 to release R2 → Allow P1 to continue.
Device Management controls all hardware devices and manages their input/output operations. The OS communicates with devices via device drivers.
Example: The printer driver converts data from applications into a format that the printer understands.
Example: Printer used exclusively by one process until printing is done.
Example: Hard disk accessed by multiple applications.
Example: Each user gets a virtual terminal session on the same physical terminal.
Input devices send data to the computer (e.g., keyboard, mouse), while output devices receive data from the computer (e.g., monitor, printer).
Example: Mouse → Input Device Display Monitor → Output Device
Devices used to store data, including primary (RAM), secondary (Hard Drive), and tertiary (optical discs, backup tapes).
Example: HDD, SSD, USB drives, DVDs
Buffering is the process of storing data temporarily in memory while transferring between devices and applications.
Example: While streaming a video, the buffer holds a few seconds of video to ensure smooth playback.
Disk drives are organized into platters, tracks, and sectors. Data is stored in sectors along tracks on rotating platters.
Example: Track 0, Sector 1 might store part of a file.
Disk scheduling optimizes the order of read/write requests to reduce seek time.
Example: Requests: 10, 22, 20, 2, 40 SSTF: 20 → 22 → 10 → 2 → 40 (shortest distance first)
Includes partitioning, formatting, and mounting file systems on the disk.
Example: Formatting a drive prepares it to store files by creating a file system.
Swap space is used to extend RAM by moving inactive pages from RAM to disk.
Example: If RAM is full, OS swaps out Process A’s memory to disk to load Process B.
Techniques to ensure data is not lost or corrupted.
Example: RAID 1 mirrors data to two disks to protect against failure.
Information Management in operating systems involves organizing and controlling access to data stored in files on storage devices.
A simple file system provides basic functions like file creation, deletion, reading, writing, and naming.
Example: Creating a text file with .txt extension using a text editor and saving it to disk.
A file system has several layers: application, logical file system, file-organization module, and basic file system.
Example: User → Application → LFS → File Organization → Disk Operations
The symbolic file system translates file names to file identifiers. The basic file system handles actual read/write requests to blocks.
Example: Symbolic: "report.doc" → inode 123 Basic: inode 123 → block 15 → fetch data
This ensures only authorized users can access or modify specific files using permissions like read, write, and execute.
Example: chmod 755 file.txt → Owner: rwx, Group: r-x, Others: r-x
Example: User requests file.txt → Logical FS locates it → Physical FS reads it from disk
Files are logical storage units that store related information, such as documents, images, or programs.
Example: MP3 player reading songs sequentially → Sequential access
Organizes files in a hierarchical tree-like structure for easy access and management.
Example: C:/Users/Student/Documents/Notes.txt
Prevents unauthorized access or modifications to files.
Example: Read-only files can't be edited without permission.
Defines how changes to files are visible to users, especially in multi-user environments.
Example: UNIX semantics: updates are immediately visible to other users.
Includes boot control block, volume control block, directory structure, and file control blocks (FCB).
Example: File = 3 blocks → Contiguous: 5,6,7 | Linked: 5→6→7 | Indexed: [5,6,7]
Tracks unallocated disk space using bitmaps, free lists, or grouping.
Example: Bitmap: 0010110 → 0 = Free, 1 = Used