2.1. Introduction To I/O Subsystem Management: Lecture Notes
2.1. Introduction To I/O Subsystem Management: Lecture Notes
1|Page
LECTURE NOTES
• Character Devices: Transfer data one character (byte) at a time. Examples: Keyboards,
mice, serial ports, printers. These are used for sequential, low-volume data streams.
Device Controllers
A device controller is a hardware interface (chip or card) that manages communication between
the device and the system bus. It handles low-level operations like converting digital signals to
mechanical actions (e.g., moving a disk head).
Examples: SATA controllers for HDDs/SSDs, USB controllers for peripherals.
Advantages: Offloads CPU work, supports multiple devices per controller.
Disadvantages: Can become a bottleneck if overloaded; failures affect connected devices.
What is a bus? Classify them in categories.
Interrupts
Interrupts are signals from devices to the CPU indicating an event (e.g., data ready or operation
complete). They allow asynchronous I/O, freeing the CPU for other tasks.
Types:
• Hardware Interrupts: From devices (e.g., keyboard press).
• Software Interrupts (Traps): From programs (e.g., system calls for I/O).
Advantages: Efficient for unpredictable events; reduces CPU polling overhead.
2|Page
LECTURE NOTES
Disadvantages: Interrupt handling adds context-switching overhead; too many can cause "interrupt
storms."
We experiment this in real-time systems like gaming, interrupts ensure quick response to user input
(e.g., mouse clicks).
Give a real life scenario to describe an interrupt you usually face with related devices such as your
phone.
Give examples of maskable and non-maskable interrupts that exist in the computer system. Use a
table to differentiate them.
3|Page
LECTURE NOTES
Hard Disk Drives (HDD) and Solid State Drives (SSD) are two types of storage devices used to
store data on computers,laptops, and other devices. While HDDs have been around for decades,
SSDs are a newer, faster, and more advanced technology. The main difference between them lies
in how they store and access data. Let's look at the fundamental distinctions between HDD and
SSD.
What is a Hard Disk Drive(HDD)?
An HDD consists of a spinning disk (platter) coated with a magnetic material and a read/write
head that reads and writes data on the disk's surface. The read/write head moves back and forth
across the spinning disk to access different parts of the data stored on the disk. HDDs have been
around for decades and are the more traditional type of storage device.
retrieves the data, which is then sent to the computer. An I/O controller manages communication
between the HDD and the computer, ensuring data is accessed correctly. Since HDDs have moving
parts, they are slower and can wear out over time compared to Solid State Drives (SSDs), which
have no moving components. However, HDDs remain popular because they offer large storage
capacity at a lower cost.
5|Page
LECTURE NOTES
SSDs use NAND flash memory chips to store data. When you save a file, electrical charges are
used to store information in tiny memory cells inside these chips. Each cell retains data even when
the power is turned off, allowing the SSD to keep your files permanently. Since SSDs have no
spinning disks or moving read/write heads like HDDs, they can access data almost instantly.
When you open a file or program, the SSD's controller quickly finds the required data and sends
it to the computer. Because SSDs rely on electronic circuits rather than mechanical parts, they
operate silently, use less power, and are more resistant to damage from drops or shocks. Their
speed significantly improves computer performance, making tasks like booting up, loading
applications, and transferring files much faster compared to HDDs.
• DMA (Direct Memory Access): A DMA controller transfers data directly between device
and memory, bypassing the CPU. We can experiment this from copying large files from
disk to memory without CPU intervention. It can bring high throughput for bulk transfers;
and it equally frees the CPU entirely. Some drawbacks may be that , it requires dedicated
hardware, it is equally a potential bus contention system. A use case is video streaming or
network packet transfers in high-performance servers.
7|Page
LECTURE NOTES
Types of Buffering in OS
There are mainly three types of Buffering that are used in the operating system;
• Single Buffering
• Double Buffering
• Circular Buffering
• Single Buffering
This is the simplest type of Buffering where only one system buffer is allocated by the Operating
System for the system to work with. The producer(I/O device) produces only one block of data in
the buffer for the consumer to receive. After one complete transaction of one block of data, the
buffer memory again produces the buffer data.
• Double Buffering
This is an upgrade over Single Buffering as instead of using one buffer data here two are used. The
working of this is similar to the previous one, the difference is that the data is first moved to the
first buffer then it is moved to the second buffer. Then retrieved by the consumer end. Here on one
hand the data is inserted into one buffer while the data in the other buffer is processed into the
other one.
8|Page
LECTURE NOTES
• Circular Buffering
Double Buffering is upgraded to this, in this process more than two buffers are used. The
mechanism which was used earlier is a bit enhanced here, where one buffer is used to insert the
data while the next one of it used to process the data that was earlier inserted. This chain of
processing is done until the last buffer in the queue and then the data is retrieved from the last
buffer by the consumer. This mechanism is used where we need faster data transfers and more
bulky data is transferred.
9|Page
LECTURE NOTES
Function of Buffering in OS
Synchronization: This process increases the synchronization of different devices that are
connected, so the system's performance also improves.
Smoothening: The input and output devices have different operating speeds and Buffer data block
sizes, this process encapsulates the difference and ensures a smooth operation.
Efficient Usage: Using this processing technique the system overhead and the inefficient usage of
the system resources.
Advantages of Buffering
• Buffering significantly reduces the waiting time for a process or application to access a
device in the system
• Smoothens the I/O operations between the different devices that are connected to the
system.
• Using Buffer number of calls needed for carrying out an operation, so it increases the
overall performance of the system.
• Buffering helps cut down on the number of I/O operations that are needed to access the
desired data.
Disadvantages of Buffering
• Buffers/Temporary memory that is used to assign data while transferring takes up a lot of
memory in a long process.
• Most of the time the exact size of the data going to be transferred is unpredictable so more
memory is assigned for every data and most of the time the extra space goes wasted.
• Due to unpredictability sometimes more data is stored on the Buffer than it can store which
leads to Buffer Overflow and data corruption.
• In some situations, Buffers can result in a delay between the read and write of the data in
the memory and the processing of the data.
10 | P a g e
LECTURE NOTES
11 | P a g e
LECTURE NOTES
1. Hardware-Based:
Uses a dedicated physical controller to manage hard drives. Offers high speed and reliability. Can
work independently from the computer's processor. Often built into the motherboard or as a
separate card. Think of it as a captain managing the drives smoothly.
2. Software-Based:
Uses the computer’s processor and memory to manage RAID. No special hardware needed. Cost-
effective, but may reduce overall system performance. Slower than hardware RAID. Acts like a
helpful assistant, but shares the load with other tasks.
3. Firmware-Based (Fake RAID):
Built into the computer's BIOS/firmware and works during boot-up. Needs a driver after the OS
loads. Cheaper than hardware RAID, but still uses CPU resources. Also known as hybrid RAID or
fake RAID. A startup helper that hands over the job to software once the system runs.
Types of RAID
1. RAID-0 (Stripping)
RAID-0 improves system performance by splitting data into smaller "blocks" and spreading them
across multiple disks. This process is called "striping." It enhances data access speed by enabling
parallel read/write operations but provides no redundancy or fault tolerance.
A set of blocks distributed across the disks forms a "stripe." For instance, "0, 1, 2, 3" is one stripe.
Instead of placing just one block into a disk at a time, we can work with two (or more) blocks
placed into a disk before moving on to the next one.
Evaluation:
• Reliability: 0, There is no duplication of data. Hence, a block once lost cannot be recovered.
12 | P a g e
LECTURE NOTES
• Capacity: N∗B, The entire space is being used to store data. Since there is no duplication,
N disks each having B blocks are fully utilized.
Advantages:
• It is easy to implement.
• It utilizes the storage capacity in a better way.
Disadvantages:
• A single drive loss can result in the complete failure of the system.
• It's not a good choice for a critical system.
2. RAID-1 (Mirroring)
RAID-1 enhances reliability by creating an identical copy (mirror) of each data block on separate
disks. This ensures that even if one disk fails, the data remains accessible from its duplicate. While
this configuration is highly reliable, it requires significant storage overhead.
Mirroring: Each block of data is written to two (or more) disks. For example:
• Block 0 is stored on Disk 0 and its duplicate on Disk 1.
• Block 1 is stored on Disk 2 and its duplicate on Disk 3.
Mirroring Level 2: In the figure, "mirroring level 2" indicates that there are two copies of each
block, distributed across different disks. RAID 0 was unable to tolerate any disk failure. But RAID
1 is capable of reliability.
Evaluation: Assume a RAID system with mirroring level 2.
• Reliability: 1 to N/2
1 to N/2, If we are lucky enough and disks 0 and 2 fail, then this can be handled as the blocks of
these disks have duplicates on disks 1 and 3. So, in the best case, N/2 disk failures can be handled.
• Capacity: (N*B)/ 2, Only half the space is being used to store data. The other half is just a
mirror of the already stored data.
13 | P a g e
LECTURE NOTES
Advantages:
• It covers complete redundancy.
• It can increase data security and speed.
Disadvantages:
• It is highly expensive.
• Storage capacity is less.
Advantages:
• In case of Error Correction, it uses hamming code.
• It Uses one designated drive to store parity.
Disadvantages:
• It has a complex structure and high cost due to extra drive.
• It requires an extra drive for error detection.
4. RAID-3 (Byte-Level Stripping with Dedicated Parity)
RAID-3 enhances fault tolerance by employing byte-level striping across multiple drives and
storing parity information on a dedicated parity drive. The dedicated parity drive allows for the
reconstruction of lost data if a single drive fails. This configuration is suitable for workloads
requiring high throughput for sequential data but is less efficient for random I/O operations.
14 | P a g e
LECTURE NOTES
Here Disk 3 contains the Parity bits for Disk 0, Disk 1 and Disk 2. If data loss occurs, we can
construct it with Disk 3.
Evaluation:
• Reliability: RAID-3 can tolerate the failure of one disk. The lost data can be reconstructed
using the parity drive and the remaining data drives.
• Capacity: Usable Capacity = ( N – 1 ) × B =(N−1)× B ,where N is the total number of
drives and B is the number of blocks per drive. The capacity of one drive is reserved for
storing parity information.
Advantages:
• Data can be transferred in bulk.
• Data can be accessed in parallel.
Disadvantages:
• It requires an additional drive for parity.
• In the case of small-size files, it performs slowly.
What is the difference between RAID 2 and RAID 3.
15 | P a g e
LECTURE NOTES
Assume that in the above figure, C3 is lost due to some disk failure. Then, we can recompute the
data bit stored in C3 by looking at the values of all the other columns and the parity bit. This allows
us to recover lost data.
Evaluation:
• Reliability: 1, RAID-4 allows recovery of at most 1 disk failure (because of the way parity
works). If more than one disk fails, there is no way to recover the data.
Capacity: ( N – 1 ) ∗ B (N−1)∗B, One disk in the system is reserved for storing the parity. Hence,
( N – 1 ) (N−1) disks are made available for data storage, each disk having B blocks.
Advantages: It helps in reconstructing the data if at most one data is lost.
Disadvantages: It can't help reconstructing data when more than one is lost.
16 | P a g e
LECTURE NOTES
• Block-Level Striping: Data is divided into blocks and striped across all drives in the array.
• Distributed Parity: Parity bits, calculated using the XOR function, are distributed across all
drives in a rotating pattern.
Example:
17 | P a g e
LECTURE NOTES
• Block-Level Striping: Data is divided into blocks and striped across all disks in the array.
• Double Distributed Parity: Two sets of parity information are calculated for every block
and distributed across all disks in the array in a rotating pattern.
Example:
Evaluation:
• Reliability: RAID-6 can tolerate the simultaneous failure of two disks, providing greater
fault tolerance than RAID-5.
• Capacity: Usable Capacity = ( N – 2 ) × B (N−2) × B where N is the total number of disks
and B is the number of blocks per disk.
Advantages:
• Very high data Accessibility.
• Fast read data transactions.
Disadvantages:
• Due to double parity, it has slow write data transactions.
• Extra space is required.
18 | P a g e
LECTURE NOTES
Interface Layer: High-level operations exposed to users and programs (e.g., via system calls).
Logical Layer: Internal representations like files and directories.
Physical Layer: Actual data placement on storage media.
Use Cases
In cloud storage (e.g., AWS S3), file systems handle distributed data across servers.
19 | P a g e
LECTURE NOTES
In mobile Operating systems like Android, they manage app data isolation.
• Inodes (Index Nodes): Metadata structures storing file attributes (e.g., size, timestamps,
permissions) and pointers to data blocks. In ext4 (Linux), each file has an inode with
direct/indirect block pointers. Leads to efficient metadata access, supports sparse files.
What is a parse file?
A drawback maybe Fixed inode count can limit file creation. Applicable in Unix-like systems for
quick attribute lookups.
• Directories: Special files containing mappings from names to inodes. A directory entry
(dirent) with filename and inode number. It enables hierarchical organization but leads to
directory fragmentation over time. Applications maybe File explorers like Windows
Explorer.
File organization determines how data blocks are linked, while directory organization structures
the namespace.
File Organization Types
We have ;
- Sequential (Contiguous): Data stored in consecutive blocks.
Example: A 10KB file occupies blocks 100-109.
Advantages: Fast sequential access; simple implementation.
Disadvantages: Fragmentation; inefficient for growing files.
- Linked: Each block points to the next (linked list).
Example: Block 100 points to 150, which points to 200.
Advantages: No external fragmentation; easy to grow.
Disadvantages: Slow random access (traverse list); overhead per block.
Use Cases: FAT file systems for small files.
- Indexed: An index block holds pointers to data blocks.
Example: Inode with array of block addresses.
Advantages: Fast random access; supports large files via multi-level indexing.
Disadvantages: Extra space for index; complex for small files.
Use Cases: Databases requiring quick jumps (e.g., video editing).
• Single-Level: All files in are in one flat directory. The early MS-DOS with all files at the
root directory. It provies fast and efficient lookup. But equally leads to Name collisions,
difficulty in multiple file management. Embedded systems use this type especially when
they have few files.
• Hierarchical (Tree-Structured): Nested directories. A hierarchical tree structure arranges
data in a tree-like format where each node has parent and child nodes, creating a hierarchy.
Hierarchical trees provide a clear and organized way to represent relationships between
different elements of data Example: /home/user/docs/[Link] in Unix. It can facilitate
Logical grouping and equally scalability.
What is scalability?
The hierarchical organization may lead to longer path resolutions and deep nesting issues.
The operating systems we use today like Windows use this for user data organization.
21 | P a g e
LECTURE NOTES
• Linked Allocation:
In linked allocation, file blocks are not stored continuously in memory. Instead, each file is
represented as a linked list of disk blocks, where each block contains a pointer to the next block.
This allows the blocks to be scattered across the disk, eliminating the need for contiguous memory
allocation. Each block has a pointer to the next; no contiguous requirement. This is Flexible and
offers no fragmentation waste.
A draw back maybe Pointer overhead and reliability issues if link breaks.
It is used in media such as Floppy disks or low-end storage.
Bitmaps (Bit Vectors): In disk free space management, the bitmap or bit vector approach is
commonly used to track the allocation status of disk blocks. In this method, each block is
represented by 1 bit. A bit value of 0 indicates that the block is free. A bit value of 1 indicates that
the block is allocated. For 1TB disk with 4KB blocks, bitmap is ~32MB.
Advantages maybe Compactness, fast to find free blocks through bit operations.
Drawbacks maybe large bitmaps for big disks scanning for contiguous space is slow.
22 | P a g e
LECTURE NOTES
Linked Lists: In this approach, Free blocks are linked together in a list. Each free block stores the
address of the next free block. The list is maintained dynamically as blocks are allocated and freed.
The Free list head points to first free block. They have no extra space; easy to allocate/deallocate.
They may be Slow to traverse for large free spaces, fragmentation.
Applicable in simple Operating system or memory management.
Boundary Tags
In this approach, Each block contains a boundary tag indicating its size and whether it is free or
occupied. Adjacent free blocks are merged during deallocation to reduce fragmentation. Useful in
memory management systems. Simplifies coalescing of adjacent free blocks. Despite that , Slight
overhead in storing tag information. It is more complex than bitmap or linked list.
23 | P a g e
LECTURE NOTES
Free List
In this approach, The free blocks are maintained in a list (array or linked list). Each entry in the
free list points directly to a free block on disk.
It offers fast allocation as free blocks are known upfront. Easy to traverse and maintain.
As cons, Extra memory is needed to store the list. May suffer from fragmentation over time
3.5. Specific File Systems: FAT and NTFS
FAT (File Allocation Table) and NTFS (New Technology File System) are two file systems used
by Windows, each with distinct features, advantages, and limitations.
FAT is a simple file system developed by Microsoft in the 1970s, primarily for small disks and
simple folder structures. The most common variant today is FAT32. FAT32 is widely supported
across various operating systems and devices, making it ideal for removable storage like USB
drives and memory cards.
24 | P a g e
LECTURE NOTES
FAT32 stands for File Allocation Table. FAT32 is an extension of previous file systems in which
the data is stored in chunks of 32 bits. FAT32 is an upgraded version of FAT16 designed to
overcome the limitations of FAT16 and add support for larger media. FAT32 was used in older
versions of operating systems like Windows 95 up until Windows XP.
FAT32 is the original file system for the Windows operating system, having been developed in the
1970s. It was mainly made for floppy drives with capacities less than 500 K. Each of the three FAT
file systems—FAT12, FAT16, and FAT32—has a different file size and disc layout. Initially, MS-
DOS used the FAT file system, with a maximum hard drive size of 32 MB and sectors partitioned
into 512 K. It frequently appears in removable discs and storage devices. A FAT32 drive's
maximum file size is limited to 4 GB, while the size of a FAT32 partition cannot exceed 8 TB. The
lack of security offered by FAT32 is its primary drawback. File access protection is absent from
FAT16, the prior version of the file system, and thus suffers from internal fragmentation.
25 | P a g e
LECTURE NOTES
26 | P a g e
LECTURE NOTES
NTFS
NTFS stands for New Technology File System. First introduced in 1993, it is used in newer
versions of operating systems such as Windows NT and 2000 and later versions of Windows. NTFS
is a more robust, high-performance logging file system with multi-user access control, ACLs, and
many other things that make it appropriate to work with an Operating System that has protection.
NTFS includes characteristics such as data recovery, multi-streaming, fault tolerance, security,
extended file size, and file systems, UNICODE names. exFAT is used where NTFS is not feasible,
due to its data-structure overhead, but a greater file-size limit than the standard FAT32 file system
is needed.
Features of NTFS
Advanced Features: NTFS is a feature-rich file system designed to meet the needs of modern
computing environments. It supports features including record compression, encryption, disk
quotas, symbolic links, and document system journaling, imparting greater flexibility and
capability compared to FAT32.
Dynamic Disk Support: NTFS supports dynamic disks, which allows for superior disk
management capabilities consisting of software RAID (Redundant Array of Independent Disks).
Sparse File Support: Sparse documents are used in programs along with digital machines and
database systems to effectively allocate garage space for facts this is in general empty.
Transaction Support: NTFS helps transactions, permitting a couple of report machine operations
to be grouped together as a single atomic transaction. This ensures statistics integrity and
consistency, specially in situations where more than one operations want to be done together (e.G.,
database transactions).
Improved Security: NTFS presents sturdy security features, which includes file and folder
permissions, get right of entry to access control lists (ACLs), and encryption.
27 | P a g e
LECTURE NOTES
Advantages of NTFS
NTFS is highly secure because it prevents unauthorized access to file contents by enforcing
Encryption File System(EFS).
NTFS performs well even in the partitions of size over 400 MB.
NTFS is less susceptible to fragmentation.
NTFS offers faster processing and is more stable than FAT32. File attributes can also be classified
as resident or non-resident. While the non-resident features are maintained outside of MFT, the
resident characteristics are retained within MFT. When Windows starts, the MFT is loaded and all
properties are retained if the file is less than 1KB.
Physical and logical disc issues may be automatically fixed by the NTFS file system. The sector
is checked before every read and write operation. Any mistakes that arise while reading will be
reported. If an issue arises during writing the data, it will choose the appropriate sector to write the
data in. Additionally, it will highlight the damaged area so you don't use it again.
Disadvantages of NTFS
NTFS is not extensively supported.
Performance in the NTFS file system degrades under partitions of 400 MB.
It takes a lot of extra space for the NTFS file system to function. "Space overhead" is the term for
the data storage used by the file system itself; this data storage is not meant to hold other kinds of
data. Therefore, if you format a drive that uses the NTFS file system, you will lose some storage
capacity.
One of the main problems with the NTFS file system is that it is incompatible. Windows 2000 and
later operating system versions are compatible with it. Windows versions prior to this one are not
compatible.
File naming is subject to several limitations. The maximum character count for the directory and
file names is 255. The system does not distinguish between lowercase and uppercase letters, even
though file names may contain capital letters.
Because of the required space overhead, a floppy disc cannot be formatted using the NTFS file
system. Floppy disc drives are widely used in older Windows-based computers.
Without the aid of third-party software, Mac computers are unable to write data on NTFS formatted
storage.
28 | P a g e
LECTURE NOTES
29 | P a g e
LECTURE NOTES
• Request a resource
• Use the resource
• Release the resource
Deadlock arises when processes hold some resources while waiting for others.
Example:
d
Examples of Deadlock
There are several examples of deadlock. Some of them are mentioned below.
1. The system has 2 tape drives. P0 and P1 each hold one tape drive and each needs another one.
2. Semaphores A and B, initialized to 1, P0, and P1 are in deadlock as follows:
30 | P a g e
LECTURE NOTES
P0 P1
Request 80KB Request 70KB
Request 60KB Request 80KB
1.) Mutual Exclusion: Only one process can use a resource at any given time i.e. the resources
are non-sharable.
2.) Hold and Wait: A process is holding at least one resource at a time and is waiting to acquire
other resources held by some other process.
3.) No Preemption: A resource cannot be taken from a process unless the process releases the
resource.
4.) Circular Wait: set of processes are waiting for each other in a circular fashion. For example,
imagine four processes P1, P2, P3, and P4 and four resources R1, R2, R3, and R4.
31 | P a g e
LECTURE NOTES
The banker's algorithm is a deadlock avoidance algorithm used in operating systems. It was
proposed by Edsger Dijkstra in 1965. The banker's algorithm works on the principle of ensuring
that the system has enough resources to allocate to each process so that the system never enters a
deadlock state. It works by keeping track of the total number of resources available in the system
32 | P a g e
LECTURE NOTES
and the number of resources allocated to each process. The algorithm is used to prevent deadlocks
that can occur when multiple processes are competing for a finite set of resources. The resources
can be of different types such as memory, CPU cycles, or I/O devices. It works by first analysing
the current state of the system and determining if granting a resource request from a process will
result in a safe state. A state is considered safe if there is at least one sequence of resource
allocations that can satisfy all processes without causing a deadlock.
The Banker's algorithm assumes that each process declares its maximum resource requirements
upfront. Based on this information, the algorithm allocates resources to each Resource-Allocation
Graph process such that the total number of allocated resources never exceeds the total number of
available resources. The algorithm does not grant access to resources that could potentially lead to
a deadlock situation. The Banker's algorithm uses a matrix called the "allocation matrix" to keep
track of the resources allocated to each process, and a "request matrix" to keep track of the
resources requested by each process. It also uses a "need matrix" to represent the resources that
each process still needs to complete its execution. To determine if a request can be granted, the
algorithm checks if there is enough available resources to satisfy the request, and then checks if
granting the request will still result in a safe state. If the request can be granted safely, the algorithm
grants the resources and updates the allocation matrix, request matrix, and need matrix accordingly.
If the request cannot be granted safely, the process must wait until sufficient resources become
available.
1. Initialize the system
Define the number of processes and resource types. Define the total number of available resources
for each resource type. Create a matrix called the "allocation matrix" to represent the current
resource allocation for each process. Create a matrix called the "need matrix" to represent the
remaining resource needs for each process.
2. Define a request
A process requests a certain number of resources of a particular type.
3. Check if the request can be granted
Check if the requested resources are available. If the requested resources are not available, the
process must wait. If the requested resources are available, go to the next step.
33 | P a g e
LECTURE NOTES
DEADLOCK PREVENTION
Deadlock prevention is a strategy used in computer systems to ensure that different processes can
run smoothly without getting stuck waiting for each other forever. Think of it like a traffic system
where cars (processes) must move through intersections (resources) without getting into a gridlock.
As we have already discussed that deadlock can only happen if all four of the following conditions
are met simultaneously:
• Mutual Exclusion
• Hold and Wait
• No Preemption
• Circular Wait
So we can prevent a Deadlock by eliminating any of the above four conditions. Let's look at how:
34 | P a g e
LECTURE NOTES
For Example, Process1 declares in advance that it requires both Resource1 and Resource2.
By eliminating hold: The process has to release all resources it is currently holding before making
a new request.
For Example: Process1 must release Resource2 and Resource3 before requesting Resource1.
3. Eliminate No Preemption
No preemption means resources can’t be taken away once allocated. To prevent this:
Processes must release resources voluntarily: A process gives up resources once it finishes using
them.
Avoid partial allocation: If a process requests resources that are unavailable, it must release all
currently held resources and wait until all required resources are free.
4. Eliminate Circular Wait
Circular wait happens when processes form a cycle, each waiting for a resource held by the next.
To prevent this:
- Impose a strict ordering on resources.
- Assign each resource a unique number.
- Processes can only request resources in increasing order of their numbers.
- This prevents cycles, as no process can go backwards in numbering.
35 | P a g e
LECTURE NOTES
What is a Multiprocessor?
A Multiprocessor is a computer system with two or more central processing units (CPUs) share
full access to a common RAM. The main objective of using a multiprocessor is to boost the
system’s execution speed, with other objectives being fault tolerance and application matching.
There are two types of multiprocessors, one is called shared memory multiprocessor and another
is distributed memory multiprocessor. In shared memory multiprocessors, all the CPUs shares the
common memory but in a distributed memory multiprocessor, every CPU has its own private
memory. The interconnection among two or more processor and shared memory is done with three
methods
36 | P a g e
LECTURE NOTES
As the name itself indicates, in this method contains a single shared bus through which all
processor & memory unit can be communicated.
Consider CPU-1 is interacting with memory unit using common shared bus in that case all other
processor must be idle as we have only one bus to communicate.
Some advantages to this are ;
• Simple to implement.
• Due to single common bus cost to implement is very less.
Disadvantages maybe;
• Data transfer rate maybe slow , due to the bus architecture.
•
2)Multiport memories
Unlike in the shared common bus method, this contains separate bus for each processor to
communicate with the memory module. Suppose CPU-1 wants to interact with memory module 1
then port mm1 is enabled. Similarly CPU-4 wants to interact with memory module 4 then port
mm4 is enabled. Hence, all the processes can be communicated parallelly. If more than one CPU
request for same time memory module, priority will be given in the order of CPU-1,CPU-2,CPU-
3,CPU-4.
37 | P a g e
LECTURE NOTES
38 | P a g e
LECTURE NOTES
Applications of Multiprocessor
• As a uniprocessor, such as single instruction, single data stream (SISD).
• As a multiprocessor, such as single instruction, multiple data stream (SIMD), which is
usually used for vector processing.
• Multiple series of instructions in a single perspective, such as multiple instruction, single
data stream (MISD), which is used for describing hyper-threading or pipelined processors.
• Inside a single system for executing multiple, individual series of instructions in multiple
perspectives, such as multiple instruction, multiple data stream (MIMD).
39 | P a g e
LECTURE NOTES
What is a Multicomputer ?
A multicomputer system is a computer system with multiple processors that are connected together
to solve a particular problem. Each processor has its own memory and it is accessible by that
particular processor and those processors can communicate with each other through an
interconnection network. As the multicomputer is capable of messages passing between the
processors, it is possible to divide the task between the processors to complete the task. Hence, a
multicomputer can be used for distributed computing. It is cost effective and easier to build a
multicomputer than a multiprocessor.
• Multiprocessor is a system with two or more central processing units (CPUs) that is capable
of performing multiple tasks where as a multicomputer is a system with multiple processors
that are attached via an interconnection network to perform a computation task.
• A multiprocessor system is a single computer that operates with multiple CPUs where as a
multicomputer system is a cluster of computers that operate as a singular computer.
• Construction of multicomputer is easier and cost effective than a multiprocessor.
• In multiprocessor system, a program tends to be easier where as in multicomputer system,
program tends to be more difficult.
• Multiprocessor supports parallel computing, Multicomputer supports distributed
computing.
Advantages
• Improved performance: Multicomputer systems can execute tasks faster than single-
computer systems, as the workload can be distributed across multiple computers.
• Better scalability: Multicomputer systems can be scaled more easily than single-computer
systems, as additional computers can be added to the system to handle increased workloads.
• Increased reliability: Multicomputer systems can continue to operate even if one computer
fails, as the remaining computers can continue to execute tasks.
• Reduced cost: Multicomputer systems can be more cost-effective than building a single
large computer system to handle the same workload.
40 | P a g e
LECTURE NOTES
Disadvantages
• Increased complexity: Multicomputer systems are more complex than single-computer
systems, and they require additional hardware, software, and management resources.
• Higher power consumption: Multicomputer systems require more power to operate than
single-computer systems, which can increase the cost of operating and maintaining the
system.
• Difficult programming: Developing software that can effectively utilize multiple
computers can be challenging, and it requires specialized programming skills.
• Synchronization issues: Multicomputer systems require synchronization between
computers to ensure that tasks are executed correctly and efficiently, which can add
complexity and overhead to the system.
• Network latency: Multicomputer systems rely on a network to communicate between
computers, and network latency can impact system performance.
VIRTUALIZATION TECHNIQUES
Virtualization is a way to use one computer as if it were many. Before virtualization, most
computers were only doing one job at a time, and a lot of their power was wasted. Virtualization
lets you run several virtual computers on one real computer, so you can use its full power and do
more tasks at once. In cloud computing, this idea is taken further. Cloud providers use
virtualization to split one big server into many smaller virtual ones, so businesses can use just what
they need, no extra hardware, no extra cost.
41 | P a g e
LECTURE NOTES
Hypervisors
A hypervisor is the software that gets virtualization to work. It serves as an intermediary between
the physical computer and the virtual machines. The hypervisor controls the virtual machines' use
of the physical resources (such as the CPU and memory) of the host computer.
42 | P a g e
LECTURE NOTES
Types of Virtualization
1. Application Virtualization: Application virtualization enables remote access by which users
can directly interact with deployed applications without installing them on their local machine.
Your personal data and the applications settings are stored on the server, but you can still run it
locally via the internet. It’s useful if you need to work with multiple versions of the same software.
Common examples include hosted or packaged apps. Example: Microsoft Azure lets people use
their applications without putting them on their own computers. Once this application is setup in
the cloud then employees can use it from any device, like a laptop or tablet. It feels like the
application is on their computer, but it’s really running on Azure’s servers. This makes things
easier, faster, and safer for the company.
43 | P a g e
LECTURE NOTES
2. Network Virtualization: This allows multiple virtual networks to run on the same physical
network, each operating independently. You can quickly set up virtual switches, routers, firewalls,
and VPNs, making network management more flexible and efficient.
Example: Google Cloud is an example of Network Virtualization. Companies create their own
networks using software instead of physical devices with the help of Google Cloud. They can set
up things like IP addresses, firewalls, and private connections all in the cloud. This makes it easy
to manage, change, and grow their network without buying any hardware. It saves time, money,
and gives more flexibility.
3. Desktop Virtualization: Desktop virtualization is a process in which you can create different
virtual desktops that users can use from any device like laptop, tablet. It’s great for users who need
flexibility, as it simplifies software updates and provides portability.
4. Storage Virtualization: This combines storage from different servers into a single system,
making it easier to manage. It ensures smooth performance and efficient operations even when the
underlying hardware changes or fails. Example: Amazon S3 is an example of storage virtualization
because in S3 we can easily store any amount of data from anywhere. Suppose a MNC have lots
of files and data of company to store. By Amazon S3 company can store all their files and data in
one place and access these from anywhere without any kind of issue in secure way.
5. Server Virtualization: This splits a physical server into multiple virtual servers, each
functioning independently. It helps improve performance, cut costs and makes tasks like server
migration and energy management easier. Example: A startup company has a powerful physical
server. This company can use server virtualization software like VMware vSphere, Microsoft
Hyper-V or KVM to create more virtual machines(VMs) on that one server. Each VM here is an
isolated server, that runs on their own operating system( like Windows and Linux) and run it's own
applications. For example, a company might run A web server on one VM, A database server on
another VM, A file server on a third VM all on the same physical machine. This reduces costs,
makes it easier to manage and back up servers, and allows quick recovery if one VM fails.
44 | P a g e
LECTURE NOTES
6. Data Virtualization: This brings data from different sources together in one place without
needing to know where or how it’s stored. It creates a unified view of the data, which can be
accessed remotely via cloud services. Example: Companies like Oracle and IBM offer solutions
for this.
DISTRUBUTED SYSTEMS
A distributed system is a collection of independent computers that work together to appear as a
single cohesive system to users. These systems coordinate their actions by passing messages over
a network, sharing resources, data, and tasks to achieve a common goal. Examples include Google
Search, cloud computing platforms, and multiplayer online games.
45 | P a g e
LECTURE NOTES
A distributed system, on the other hand, disperses data and resources over several servers or
locations, frequently across various physical places. Better scalability and reliability are made
possible by this configuration since the system can function even in the event of a component
failure. However, because of their numerous points of interaction, distributed systems can be more
difficult to secure and administer.
• Client-Server Architecture:
In this setup, servers provide resources or services, and clients request them. Clients and servers
communicate over a network. Examples: Web applications, where browsers (clients) request pages
from web servers.
• Peer-to-Peer (P2P) Architecture:
Each node, or "peer," in the network acts as both a client and a server, sharing resources directly
with each other. Examples: File-sharing networks like BitTorrent, where files are shared between
users without a central server.
• Three-Tier Architecture:
This model has three layers: presentation (user interface), application (business logic), and data
(database). Each layer is separated to allow easier scaling and maintenance. Examples: Many web
applications use this to separate user interfaces, logic processing, and data storage.
• Microservices Architecture:
The application is split into small, independent services, each handling specific functions. These
services communicate over a network, often using REST APIs or messaging. Examples: Modern
web applications like Netflix or Amazon, where different services handle user accounts, orders,
and recommendations independently.
• Service-Oriented Architecture (SOA):
Similar to microservices, SOA organizes functions as services. However, SOA typically uses an
enterprise service bus (ESB) to manage communication between services. Examples: Large
enterprise applications in finance or government, where different services handle various aspects
of business processes.
• Event-Driven Architecture:
Components interact by sending and responding to events rather than direct requests. An event
triggers specific actions or processes in various parts of the system. Examples: Real-time
applications like IoT systems, where sensors trigger actions based on detected events. The most
common forms of distributed systems today operate over the internet, handing off workloads to
dozens of cloud-based virtual server instances that are created as needed, and then terminated when
the task is complete.
46 | P a g e
LECTURE NOTES
As we can see that each Autonomous System has a common Application that can have its own data
that is shared by the Centralized Database System. To Transfer the Data to Autonomous Systems,
Centralized System should be having a Middleware Service and should be connected to a Network.
Middleware Services enable some services which are not present in the local systems or centralized
system default by acting as an interface between the Centralized System and the local systems. By
using components of Middleware Services systems communicate and manage data.
47 | P a g e
LECTURE NOTES
The Data which is been transferred through the database will be divided into segments or modules
and shared with Autonomous systems for processing.
The Data will be processed and then will be transferred to the Centralized system through the
network and will be stored in the database.
Characteristics of Distributed System
• Resource Sharing: It is the ability to use any Hardware, Software, or Data anywhere in the
System.
• Openness: It is concerned with Extensions and improvements in the system (i.e., How
openly the software is developed and shared with others)
• Concurrency: It is naturally present in Distributed Systems, that deal with the same activity
or functionality that can be performed by separate users who are in remote locations. Every
local system has its independent Operating Systems and Resources.
• Scalability: It increases the scale of the system as a number of processors communicate
with more users by accommodating to improve the responsiveness of the system.
• Fault tolerance: It cares about the reliability of the system if there is a failure in Hardware
or Software, the system continues to operate properly without degrading the performance
the system.
• Transparency: It hides the complexity of the Distributed Systems to the Users and
Application programs as there should be privacy in every system.
Advantages of Distributed System
• Scalability: Distributed systems can easily grow by adding more computers (nodes),
allowing them to handle increased demand without significant reconfiguration.
• Reliability and Fault Tolerance: If one part of the system fails, others can take over,
making distributed systems more resilient and ensuring services remain available.
• Performance: Workloads can be split across multiple nodes, allowing tasks to be
completed faster and improving overall system performance.
• Resource Sharing: Distributed systems allow resources like data, storage, and computing
power to be shared across nodes, increasing efficiency and reducing costs.
• Geographical Distribution: Since nodes can be in different locations, distributed systems
can serve users globally, providing faster access to resources based on location.
• Security possess a problem due to easy access to data as the resources are shared to multiple
systems. Networking Saturation may cause a hurdle in data transfer i.e., if there is a lag in
the network then the user will face a problem accessing data. In comparison to a single user
system, the database associated with distributed systems is much more complex and
challenging to manage. If every node in a distributed system tries to send data at once, the
network may become overloaded.
48 | P a g e
LECTURE NOTES
Distributed Systems:
A distributed system is a collection of independent computers that appear to its users as a single
coherent system. In a distributed system, components located on networked computers
communicate and coordinate their actions by passing messages.
Distributed systems can encompass various architectures, including client-server, peer-to-peer, and
more.
Microservices:
Microservices is an architectural style that structures an application as a collection of small,
autonomous services, modeled around a business domain.
Each microservice is a self-contained unit that can be developed, deployed, and scaled
independently. Microservices communicate with each other over a network, typically using
lightweight protocols like HTTP or messaging queues. While microservices can be implemented
in a distributed system, they are not same. Microservices focus on architectural design principles,
emphasizing modularity, scalability, and flexibility, whereas distributed systems encompass a
broader range of concepts, including communication protocols, fault tolerance, and concurrency
control, among others.
49 | P a g e