Os PDF Linkedin
Os PDF Linkedin
prep
1. Introduction to Operating Systems
Definition
k
provides a user interface, and offers services to applications software.
n
Batch Operating Systems: Executes jobs in batches without user interaction.
ha
Jobs are collected, grouped, and processed sequentially.
frame. Used in critical systems like medical devices, automotive systems, and
industrial controls.
sh
File System Management: Manages the creation, deletion, reading, and writing
of files and directories.
Security and Access Control: Protects data and resources from unauthorized
access and ensures secure operations.
User Interface: Provides a means for users to interact with the computer,
typically through a graphical user interface (GUI) or command-line interface
(CLI).
2. Process Management
Process Concepts
● Process: An active program, including the current activity, contents of
registers, program counter, and variables.
● Process States: Different stages in the lifecycle of a process.
● New: The process is being created.
● Ready: The process is waiting to be assigned to a processor.
k
● Running: Instructions are being executed.
● Waiting: The process is waiting for some event to occur.
● Terminated: The process has finished execution.
n
ha
Process Control Block (PCB): A data structure containing all information about
a process, including process state, program counter, CPU registers, memory
management information, and accounting information.
rd
Threads
va
Thread: The smallest sequence of programmed instructions that can be
managed independently by a scheduler.
Multithreading: Allows multiple threads to exist within the context of a single
process, sharing resources but executing independently.
a
Process Scheduling:
Schedulers: Components that decide which process to execute next.
sh
Long-term Scheduler: Decides which processes are admitted to the system for
processing.
Short-term Scheduler: Selects which process should be executed next and
allocates CPU.
ar
Scheduling Algorithms:
First-Come, First-Served (FCFS): Processes are attended to in the order
they arrive.
Shortest Job Next (SJN): Selects the process with the smallest execution
time.
Priority Scheduling: Executes processes based on priority.
Round Robin (RR): Each process is assigned a fixed time slice (quantum)
in rotation.
Multilevel Queue Scheduling: Multiple queues with different priority
levels.
Context Switching
Context Switching: The process of storing the state of a currently running
process and restoring the state of the next process to be executed.
3. Memory Management
k
Memory Allocation
n
Contiguous Memory Allocation: Each process is allocated a single contiguous
section of memory.
ha
Non-contiguous Memory Allocation: Memory is divided into several sections
that can be assigned to a process.
Paging: Divides memory into fixed-sized pages.
Segmentation: Divides memory into variable-sized segments based on logical
divisions.
rd
Virtual Memory
va
Paging: Maps logical addresses to physical memory via pages and page
tables. Uses page replacement algorithms when memory is full.
Segmentation: Each segment can be different sizes, improving the fit between
the memory and the process requirements.
Page Replacement Algorithms:
a
Optimal Page Replacement: Replaces the page that will not be used for
the longest time in the future.
Memory Fragmentation
ar
k
File Allocation Methods
n
ha
Contiguous Allocation: Each file occupies a contiguous set of blocks.
Linked Allocation: Each file is a linked list of disk blocks.
Indexed Allocation: Each file has its own index block of pointers to its data
blocks.
rd
Access Methods
Sequential Access: Information in the file is processed in order, one record
va
after the other.
Direct Access: File is viewed as a numbered sequence of blocks or records,
allowing access in any order.
5. Device Management
a
sh
I/O Hardware
Polling: CPU continuously checks the status of a device.
Interrupts: Device sends an interrupt signal to the CPU to indicate that it
ar
needs attention.
Direct Memory Access (DMA): Allows devices to transfer data to/from memory
without CPU intervention.
H
Discretionary Access Control (DAC): Access rights are determined by the owner
of the resource.
Mandatory Access Control (MAC): Access rights are regulated by a central
authority based on multiple levels of security.
k
Role-Based Access Control (RBAC): Access rights are assigned based on roles
within an organization.
n
ha
rd
7. Important Operating Systems Concepts
va
Deadlocks
Necessary Condition:
a
Concurrency:
k
n
ha
8. Important Questions for Operating Systems Interviews
rd
Memory Management
va
What is Virtual Memory?
Virtual memory is a memory management technique that provides an
"idealized abstraction of the storage resources" to the user. It enables a
computer to compensate for physical memory shortages by temporarily
transferring data from random access memory (RAM) to disk storage. This
a
process allows for larger programs to run on systems with limited RAM.
sh
Paging:
ar
blocks of the same size called frames. When a program needs to access data,
the operating system translates virtual addresses to physical addresses using
a page table.
Segmentation
Segmentation is a memory management technique that divides the process's
memory into different segments based on the logical divisions, such as
functions, data, and stacks. Each segment has a name and a length, and
segments are not necessarily of equal size.
k
1. Identify the Fault: Determine that a page fault has occurred and identify the
missing page.
n
2. Locate the Page: Find the location of the required page on the disk
(secondary storage).
ha
3. Allocate a Frame: Select a free frame or use a page replacement algorithm
to free up a frame if none are available.
4. Load the Page: Transfer the required page from disk to the allocated frame
in physical memory.
rd
5.Update Tables: Update the page table and other relevant data structures to
reflect the new location of the page.
6. Resume Execution: Restart the instruction that caused the page fault.
va
FIFO (First-In-First-Out)
Advantages: Simple to implement and understand.
a
File Systems
Describe Different File Allocation Methods
Contiguous Allocation:
Advantages: Simple and allows direct access to files.
Disadvantages: Can lead to external fragmentation and is inflexible for
file growth.
Linked Allocation:
Advantages: Solves the problem of fragmentation and allows files to
grow easily.
Disadvantages: Slower direct access and requires additional space for
pointers.
Indexed Allocation:
Advantages: Supports direct access and does not suffer from external
fragmentation.
k
Disadvantages: Requires additional space for index blocks and can
suffer from internal fragmentation.
n
How Does the Operating System Manage File Systems?
ha
The operating system manages file systems through several key components
and tasks:
File Control Blocks (FCBs): Structures that store information about files, such
rd
as size, permissions, and location.
Directory Structure: Organizes files in a hierarchical manner for easy
navigation and access.
va
File System Mounting: Integrates different file systems into a single namespace.
File Operations: Handles file creation, deletion, reading, writing, and other
operations.
Access Control: Manages user permissions to ensure secure file access.
a
Inodes do not store file names; instead, directories contain the mappings
between file names and inodes.
Device Management
Device drivers are specialized programs that allow the operating system to
communicate with hardware devices. They provide a standardized interface
between the OS and the hardware, translating high-level commands into
device-specific operations. Drivers handle the intricacies of device
communication, enabling the OS and applications to use hardware without
needing to know the details of its operation.
k
Describe the Difference Between Polling and Interrupts
n
Polling: The CPU continuously checks the status of a device to see if it needs
ha
attention. This can waste CPU resources as it repeatedly queries devices.
Interrupts: Devices send an interrupt signal to the CPU when they need
attention. The CPU then pauses its current tasks, handles the interrupt, and
resumes normal operations. This is more efficient than polling as it allows the
rd
CPU to perform other tasks until an interrupt occurs.
va
Security
k
1. Mutual Exclusion: Only one process can use a resource at a time.
2.Hold and Wait: A process holding at least one resource is waiting to acquire
additional resources held by other processes.
n
3.No Preemption: Resources cannot be forcibly taken from processes holding
them.
ha
4. Circular Wait: There exists a set of processes such that each process is
waiting for a resource held by the next process in the set.
Ensured?
A critical section is a part of the code that accesses shared resources and
ar
Mutexes: A mutual exclusion object that allows only one thread to access the
critical section at a time.
Monitors: High-level synchronization constructs that provide mutual exclusion
and condition variables for managing complex synchronizations.
YouTube Playlists
1. Operating Systems - Neso Academy
2. Operating Systems - Gate Smashers
Here are some coding questions on operating systems with links:
k
These questions should help you practice important operating system
n
concepts through coding.
ha
rd
va
a
sh
ar
H