Os Exam Prep
Os Exam Prep
Operating System objectives and its evolution. Operating System structure: Layered,
Monolithic, Microkernel. Types of Operating Systems. Applications of Operating systems.
Operating Systems protection and security.
MODULE 1 - OVERVIEW OF OPERATING SYSTEM
1. Operating System Objectives and Evolution:
• Objectives:
• Layered Structure:
Disadvantages:
Uses/Applications:
• Used in complex systems where modularity and isolation are crucial, such as network
protocol stacks.
Diagram:
-------------------------------
| Application Layer |
-------------------------------
| File System Layer |
-------------------------------
| Device Driver Layer |
-------------------------------
| Hardware Layer |
-------------------------------
• Monolithic Structure:
• Single-layered structure where all OS components exist in the same address space.
• Efficient but less modular than layered structure.
• Advantages:
• Efficiency: Direct communication between components results in faster operation.
• Simplicity: Single-address space simplifies development and maintenance.
Disadvantages:
• Lack of Modularity: Difficult to modify or extend without affecting the entire system.
• Reliability: A fault in one component can affect the entire system.
Uses/Applications:
Diagram:
------------------------------------
| Application & OS Kernel |
------------------------------------
| Device Drivers |
------------------------------------
| Hardware |
------------------------------------
• Minimalist approach with core services in the kernel, and others as user-level
processes.
• Enhances flexibility and extensibility.
• Advantages:
• Flexibility: Easier to extend and modify since most services run as user-level processes.
• Reliability: Faults in user-level processes do not crash the entire system.
Disadvantages:
Uses/Applications:
• Commonly used in real-time systems and distributed systems where flexibility and
reliability are crucial.
Diagram:
-------------------------------
| User-level Processes |
-------------------------------
| Micro kernel |
-------------------------------
| Hardware Abstraction |
-------------------------------
Disadvantages:
Examples:
• IBM OS/360, UNIVAC EXEC 8.
Disadvantages:
Examples:
• UNIX, Multics.
Disadvantages:
Disadvantages:
Examples:
• VxWorks, QNX.
Advantages:
Disadvantages:
• Google's Android (for mobile devices), Microsoft Windows Server (with distributed
features).
Disadvantages:
Examples:
• Handle network requests, data storage, and user access in server environments.
Advantages:
• Network Management: Handles network requests, ensuring efficient communication.
• Data Storage: Manages storage resources and provides file and data sharing services.
• User Access Control: Enforces access controls and permissions for users.
Disadvantages:
Examples:
• Windows Server, Linux Server distributions (e.g., Ubuntu Server), macOS Server.
• Embedded Systems:
Disadvantages:
Examples:
• Android (for smartphones), FreeRTOS (for embedded systems), VxWorks (for embedded
systems).
Advantages:
Disadvantages:
Examples:
• 1. Protection:
Explanation: Protection mechanisms are like digital bouncers that ensure only authorized users
and programs get access to the computer's resources. It prevents unauthorized use and keeps the
system safe.
Technical Terms:
• Access Control Lists (ACLs): Lists that specify which users or system processes are
granted access to objects, as well as what operations are allowed on given objects.
• User Authentication: Verifying the identity of a user, often through passwords or
biometrics.
2. Security:
Explanation: Security is like a superhero shield for your computer. It defends against bad guys
trying to sneak in, steal your information, or mess with your computer's brain.
Technical Terms:
• Vulnerability Patching: Regularly updating the operating system to fix weaknesses that
could be exploited by hackers.
• Intrusion Detection Systems (IDS): Software that monitors network or system activities
for malicious activities or policy violations.
3. Access Control:
Explanation: Access control is like a secret door lock. It decides who gets in and who stays out. It
makes sure only the right people can use the computer and its programs.
Technical Terms:
• Role-Based Access Control (RBAC): Assigning permissions to users based on their role in
the organization.
• Two-Factor Authentication (2FA): Adding an extra layer of security by requiring two
different authentication methods, like a password and a code sent to your phone.
4. Encryption:
Explanation: Encryption is like turning your secrets into a secret code. Even if someone tries to
peek, they won't understand because everything is jumbled up!
Technical Terms:
Explanation: Firewalls are like protective walls around your computer, deciding who can enter.
Antivirus is like a superhero that catches and fights computer viruses trying to harm your system.
Technical Terms:
• Packet Filtering: Firewalls inspect data packets entering or leaving a network and block or
allow them based on predefined rules.
• Heuristic Analysis: Antivirus programs use this method to detect new, unknown viruses by
analyzing behavior patterns.
•
• Process Definition:
Examples of IPC:
1. Message Passing:
Explanation: Message Passing is like sending notes between processes. Imagine two friends
passing secret messages to each other. In IPC, processes can exchange information by sending
messages. It's a bit like texting, where one process sends a message, and the other receives and
understands it.
Technical Terms:
• Message Queue: A place where messages wait before being received by the intended
process.
• Synchronous Communication: Processes wait for each other to send and receive messages
at the same time.
2. Shared Memory:
Explanation: Shared Memory is like having a shared whiteboard where processes can write and
read information. Instead of passing messages, processes can leave notes on the whiteboard for
others to see. It's a faster way for them to share data because they can directly access the same
piece of memory.
Technical Terms:
• Critical Section: The part of the shared memory that needs exclusive access to avoid
conflicts.
• Mutex (Mutual Exclusion): A lock that processes use to take turns accessing the shared
memory safely.
3. Synchronization:
Explanation: Synchronization is like making sure everyone dances to the same beat. In IPC,
processes need to coordinate and work together in harmony. Synchronization ensures that they take
turns and avoid bumping into each other, just like dancers following the same rhythm.
Technical Terms:
3. Threads:
Concept of Threads:
Explanation: Threads are like mini-workers inside a big factory (process). They share the same
workspace and tools (resources), but each thread can focus on its specific task without bothering
the others. It's a way for a program to do multiple things at the same time without creating entirely
new processes.
Technical Terms:
• Lightweight Processes: Threads are lightweight compared to processes, meaning they don't
use as much computer power to start and run.
• Individual Program Counters: Each thread has its own "to-do list" (program counter) but
can still access the same materials (memory space and resources).
Explanation: Imagine a big company (process) with different departments (threads). Threads are
like different teams in those departments. They can share office space and resources (like
computers and printers), but each department is its own team, working on different tasks.
Technical Terms:
• Resource Sharing: Threads share resources like memory space, making them more
efficient.
• Creation Speed: Threads are faster to create than processes because they don't need as
much setup.
Concurrency:
Explanation: Concurrency is like having multiple chefs in a kitchen, each working on a different
dish at the same time. In computing, it's the simultaneous execution of multiple threads, allowing a
program to make progress on several tasks at once.
Technical Terms:
• Simultaneous Execution: Threads can execute their tasks at the same time, improving
overall efficiency.
Multithreading:
Explanation: Multithreading is like having different chefs (threads) in one restaurant (process),
each cooking a different dish. It's the execution of multiple threads within a single process,
allowing a program to handle multiple tasks concurrently.
Technical Terms:
• Single Process: All threads run within the same program and share resources.
Types of Threads:
Explanation: There are different types of worker arrangements. In computing, there are user-level
threads that are managed by a threads library created by the user, and kernel-level threads managed
by the operating system itself.
Technical Terms:
• User-Level Threads: Managed by a library created by the user within the program.
• Kernel-Level Threads: Managed by the operating system itself.
Explanation: POSIX Threads are like a set of tools and rules that everyone agrees on when
building their kitchens (programs with threads). It provides a standardized way to create and
manage threads, ensuring that different programs can work together seamlessly.
Technical Terms:
• API (Application Programming Interface): A set of rules and tools for building software.
• Thread Creation and Management: Functions provided by POSIX Threads for creating,
controlling, and synchronizing threads.
Scheduler:
Explanation: Think of the scheduler as a traffic cop at a busy intersection. Its job is to decide
which car (process or thread) gets to go next. The scheduler is like the conductor of an orchestra,
coordinating and deciding the order in which tasks (processes or threads) get to perform.
Technical Terms:
Explanation: The scheduler is the boss of the CPU, making sure it's always busy and not sitting
idle. It determines who gets to use the CPU at any given moment, balancing the workload and
ensuring fairness.
Technical Terms:
• CPU Time: The time a process or thread spends using the Central Processing Unit.
• Workload Balancing: Distributing the tasks evenly among processes or threads.
Types of Scheduling:
Explanation: Schedulers have different strategies for deciding who gets CPU time and when. It's
like different games played at the traffic intersection – sometimes it's first-come-first-serve, other
times it's letting the car with more people (higher priority) go first.
Technical Terms:
• Scheduling Algorithms: Rules or strategies used by the scheduler to decide the order of
task execution.
• Priority Scheduling: Giving preference to tasks with higher priority.
Explanation: Schedulers deal with two important concepts – concurrency and parallelism.
Concurrency is like handling multiple tasks in overlapping time, while parallelism is doing
multiple tasks at the exact same time.
Technical Terms:
Context Switching:
Explanation: When the scheduler decides it's time for a different process or thread to use the
CPU, it performs a context switch. It's like changing the focus from one task to another, ensuring
that everything continues smoothly.
Technical Terms:
• Context Switch: Changing from executing one task to another, including saving and
restoring the state of the task.
5) Scheduling Algorithms:
Explanation: In FCFS, processes are like customers waiting in a line at a shop. The first one in
the line gets served first. It's simple and fair, but if a lengthy process arrives first, others may be
stuck waiting for a while.
Advantages:
Disadvantages:
• Convoy Effect: Short processes may get stuck waiting behind a long one.
Example: Consider three processes arriving in order: P1, P2, P3. They get CPU time in the same
order they arrived.
Diagram:
0 ------P1------P2------P3
Explanation: SJF is like a chef prioritizing the shortest cooking tasks first. The process with the
shortest burst time (time required for execution) goes first. It minimizes waiting time but can cause
longer processes to wait indefinitely.
Advantages:
Disadvantages:
Example: Processes P1, P2, and P3 with burst times 6, 3, and 8. The order is P2, P1, P3.
Diagram:
0 ------P2------P1------P3
3. Shortest Remaining Time Next (SRTN):
Explanation: SRTN is like SJF but with interruptions. If a shorter process arrives while another is
running, it can preempt the current one. This reduces waiting time but adds complexity.
Advantages:
• Reduced Waiting Time: Shorter processes can jump ahead if they arrive.
Disadvantages:
Example: Processes P1, P2, and P3. P1 starts, but P2 arrives with a shorter burst time, so it
preempts P1.
Diagram:
0 ------P2------P1------P3
4. Priority Scheduling:
Explanation: Priority Scheduling is like a VIP line. Each process gets a priority level, and the one
with the highest priority goes first. It ensures important tasks are handled promptly but can lead to
starvation if lower-priority tasks wait too long.
Advantages:
Disadvantages:
Example: Processes P1, P2, and P3 with priorities 2, 1, and 3. The order is P2, P1, P3.
Diagram:
0 ------P2------P1------P3
5. Round Robin:
Explanation: Round Robin is like sharing toys in turns. Each process gets a fixed time slice
(quantum) to execute, and they take turns. It's fair, but short processes might wait for their turn, and
longer processes may not finish in one quantum.
Advantages:
Disadvantages:
• Waiting Time: Short processes may wait for their turn, and longer processes may not finish
in one quantum.
Example: Processes P1, P2, and P3 with a time slice of 2. The order is P1, P2, P3, P1, P2, P3, and
so on.
Diagram
0 ------P1------P2------P3------P1------P2------P3
Explanation: Mutual Exclusion is like a traffic signal that allows only one car to pass through an
intersection at a time. It ensures that only one process can access a shared resource, preventing
conflicts and chaos.
Technical Terms:
• Shared Resource: A piece of data or a section of code that multiple processes may want to
access.
Explanation: The Critical Section is like a special zone in a playground where kids take turns
playing on the same slide. It's a segment of code where shared resources are accessed, and only one
process should be there at a time.
Technical Terms:
• Critical Section: The part of the code where shared resources are accessed.
Atomic Operations:
Explanation: Atomic Operations are like a switch that turns on and off in one go without anyone
interrupting. They ensure that certain operations happen in a single, uninterruptible step.
Technical Terms:
Test-and-Set Instruction:
Explanation: The Test-and-Set Instruction is like checking if a door is locked and locking it in one
swift motion. It's an atomic instruction that tests a memory location and sets it to a new value.
Technical Terms:
Swap Instruction:
Explanation: The Swap Instruction is like swapping keys with a friend without anyone else
interfering. It atomically swaps the contents of two memory locations, ensuring a smooth
exchange.
Technical Terms:
• Atomic Swap: An operation that swaps the contents of two memory locations atomically.
3. Synchronization Mechanisms:
Semaphores:
Explanation: Semaphores are like tokens at a ticket counter. Only a limited number of people
(processes) can have a token at a time, controlling access to shared resources.
Technical Terms:
Mutex Locks:
Explanation: Mutex Locks are like keys to a room. Only one thread can have the key (lock) at a
time, ensuring that only one can access a resource.
Technical Terms:
Monitors:
Explanation: Monitors are like a dedicated room with a moderator. It's a high-level
synchronization construct that includes both data (shared resources) and procedures (code) to
control access.
Technical Terms:
Readers-Writers Problem:
Explanation: In the Readers-Writers Problem, multiple readers can enjoy a library, but only one
writer can edit a book at a time. It ensures that reading doesn't interfere with writing.
Technical Terms:
Producer-Consumer Problem:
Explanation: The Producer-Consumer Problem is like a bakery where a producer bakes and a
consumer buys. Producers add items to a shared buffer, and consumers take them.
Technical Terms:
Kernel Synchronization:
Explanation: Kernel Synchronization ensures that different parts of the operating system kernel
work together harmoniously. It's like a well-coordinated orchestra of system components.
Technical Terms:
• Kernel: The core part of the operating system that manages resources.
Interrupt Disabling:
Explanation: Interrupt Disabling is like temporarily turning off the phone's notifications to focus
on an important task. It ensures atomic operations by temporarily disabling interrupts.
Technical Terms:
Deadlock Characterization:
Explanation: Deadlock is like a group of friends holding hands in a circle and unable to move. It
happens when processes are stuck waiting for each other, creating a standstill/buffer
Technical Terms:
Technical Terms:
Memory Partitioning:
Explanation: Memory Partitioning is like dividing a pizza. In Fixed Partitioning, the pizza is pre-
sliced into equal pieces (partitions), while in Dynamic Partitioning, each person gets a slice of the
pizza according to their appetite.
Technical Terms:
Paging:
Explanation: Paging is like using a scrapbook with fixed-size pages. Physical memory is divided
into these fixed-size blocks, allowing the operating system to manage memory more efficiently.
Technical Terms:
Segmentation:
Explanation: Segmentation is like organizing a library with shelves of different sizes. Memory is
divided into segments, each serving a specific purpose, making it easier to manage.
Technical Terms:
Explanation: Virtual Memory is like having an expandable desk. It allows programs to execute as
if they have a contiguous block of memory, even if they're scattered across physical memory and
storage.
Technical Terms:
FIFO (First-In-First-Out):
Explanation: FIFO is like queuing up at a ticket counter. The oldest page in the memory gets
replaced, ensuring fairness.
Technical Terms:
• Oldest Page: The page that has been in memory the longest.
Explanation: LRU is like replacing the book you haven't touched in ages on your bookshelf. It
replaces the page that hasn't been used for the longest time.
Technical Terms:
• Least Recently Used Page: The page that has not been accessed for the longest time.
Optimal:
Explanation: Optimal is like predicting the future. It replaces the page that will not be used for the
longest time in the future, making it the most efficient but often impractical.
Technical Terms:
• Optimal Replacement: Replacing the page that minimizes future page faults.
Locality of Reference:
Explanation: Locality of Reference is like reading the same book chapter repeatedly. It's the
tendency of a program to access the same set of memory locations frequently.
Technical Terms:
Belady’s Anomaly:
Explanation: Belady’s Anomaly is like a surprise when you get more pizza slices but end up with
more hunger. Increasing the number of frames (pizza slices) may lead to more page faults, which is
not applicable to the optimal algorithm.
Technical Terms:
File Management:
Explanation: Sequential Access is like reading a book from start to finish. Direct Access is like
using an index to directly jump to a desired page.
Technical Terms:
File Directories:
Explanation: File Directories are like a table of contents in a book. They keep track of files, their
attributes, and their locations.
Technical Terms:
File Sharing:
Explanation: File Sharing is like multiple people reading the same book at once. It allows
multiple processes to access the same file simultaneously.
Technical Terms:
• Concurrency: Multiple processes accessing the same file at the same time.
Record Blocking:
Explanation: Record Blocking is like grouping paragraphs into chapters. It involves grouping
records into blocks for more efficient I/O operations.
Technical Terms:
I/O Management:
I/O Devices:
Explanation: I/O Devices are like tools used for different tasks. They are devices used for input
and output operations.
Technical Terms:
Explanation: The Organization of I/O Functions is like a director managing a movie. I/O
functions are handled by device drivers, ensuring coordination and efficiency.
Technical Terms:
• Device Drivers: Software that manages communication between the operating system and
hardware devices.
I/O Buffering:
Explanation: I/O Buffering is like a temporary storage area. It temporarily stores data during I/O
operations, allowing for smoother communication between devices.
Technical Terms:
Disk Scheduling:
Explanation: Disk Scheduling is like managing traffic on a busy road. FCFS serves requests in
the order they arrive, while SSTF serves the request with the shortest seek time.
Technical Terms:
• Seek Time: Time taken for the disk arm to move to the requested track.
Unix OS Overview:
Explanation: Unix is like a versatile and efficient team manager. It's a multi-user, multitasking
operating system that originated in the 1960s and found its strength in server environments, where
it can handle multiple tasks simultaneously.
Technical Terms:
Key Features:
Explanation: Unix is like a Swiss Army knife for computers. Its key features include being
multiuser, multitasking, and designed for portability, making it adaptable to various hardware
platforms.
Technical Terms:
Explanation: The Unix File System is like a well-organized library with a hierarchical structure.
Files and directories are organized in a tree-like structure, and permissions control who can access
what.
Technical Terms:
Process Management:
Explanation: Process Management in Unix is like juggling tasks. It involves creating, scheduling,
and terminating processes, which are instances of a program. Processes can communicate with each
other using specific mechanisms.
Technical Terms:
Windows OS:
Technical Terms:
• Graphical User Interface (GUI): A visual way of interacting with the computer.
Unix:
Explanation: Unix is like a command-line expert. Originating in AT&T's Bell Labs, it uses a
command-line interface and is widely employed in server environments.
Technical Terms:
Linux:
Technical Terms:
• Open-source: Source code is available for the public to use and modify.
Shell Scripting:
Explanation: Shell Scripting is like giving your computer a set of instructions in a language it
understands. It involves writing scripts using command-line shell commands to automate repetitive
tasks and enhance the power of the Unix command-line interface.
Technical Terms:
Technical Terms:
Unix OS Overview:
Explanation: Unix is like a versatile chef managing a busy kitchen. It's a multi-user, multitasking
operating system originally developed in the 1960s. Widely used in server environments, Unix
excels at handling multiple tasks simultaneously.
Technical Terms:
Key Features:
Explanation: Unix's key features are like the secret ingredients in a recipe. It supports multiuser
functionality, multitasking capabilities, and is designed for easy portability across different
hardware platforms.
Technical Terms:
Explanation: The Unix File System is like a well-organized bookshelf. It has a hierarchical
structure organized in a tree-like fashion. File and directory permissions act like locks, controlling
access, and inodes are data structures storing information about files.
Technical Terms:
Process Management:
Explanation: Processes in Unix are like different chefs in a bustling kitchen, each cooking its own
dish. Unix handles the creation, scheduling, and termination of processes, and provides
mechanisms for them to communicate.
Technical Terms:
Windows OS:
Technical Terms:
• GUI (Graphical User Interface): Interface with visual elements like icons and windows.
Unix:
Explanation: Unix is like a command-line kitchen where chefs rely on precise commands.
Originating in AT&T's Bell Labs, it's known for its command-line interface and widely used in
server environments.
Technical Terms:
Linux:
Explanation: Linux is like an open-source kitchen where chefs can share and modify recipes
freely. It's an open-source Unix-like operating system supporting various hardware platforms and
popular for servers, embedded systems, and personal computers.
Technical Terms:
Shell Scripting:
Explanation: Shell scripting is like creating a cooking recipe with a list of steps. It involves
writing scripts using command-line shell commands to automate repetitive tasks and enhance the
power of the Unix command-line interface.
Technical Terms:
Explanation: Shell scripting basics are like understanding the rules of a cooking competition. The
shebang indicates the shell interpreter, variables store and manipulate data, control structures
manage flow, and functions encapsulate a sequence of commands.
Technical Terms: