0% found this document useful (0 votes)
5 views49 pages

2.1. Introduction To I/O Subsystem Management: Lecture Notes

my notes will heip u to aquire knowhow in computer technology

Uploaded by

kamgayannick688
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views49 pages

2.1. Introduction To I/O Subsystem Management: Lecture Notes

my notes will heip u to aquire knowhow in computer technology

Uploaded by

kamgayannick688
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LECTURE NOTES

2.1. Introduction to I/O Subsystem Management


The Input/Output (I/O) subsystem is a critical component of an operating system (OS) responsible
for managing interactions between the computer's hardware and software. It handles data transfer
between the CPU, memory, and peripheral devices, ensuring efficient, reliable, and secure
operations. The I/O subsystem abstracts hardware complexities from applications, providing a
uniform interface while optimizing performance and resource utilization.
Key Functions of I/O Subsystem Management
• Device Independence: Allows programs to access devices without knowing hardware
specifics (e.g., reading from a file regardless of whether it's on a HDD or SSD).
• Error Handling: Detects and recovers from I/O errors, such as bad sectors on disks.
• Buffering and Caching: Temporarily stores data to bridge speed differences between CPU
and devices.
• Scheduling: Manages I/O requests to minimize wait times and optimize throughput.
• Spooling: Queues output for slow devices like printers to free up CPU time.
What do we mean by queuing?
Advantages of Effective I/O Management
• Improves system performance by reducing CPU idle time.
• Enhances reliability through error detection and recovery.
• Supports multitasking by allowing concurrent I/O operations.
Disadvantages I/O Management
• Adds overhead in terms of OS code complexity and potential latency from abstraction
layers.
• Poor I/O management can lead to bottlenecks, especially in I/O-bound systems.
The concept of I/O management is experienced in web servers, efficient I/O management handles
thousands of concurrent file reads/writes. In embedded systems like IoT devices, it optimizes
power consumption during sensor data transfers.

2.2 Introduction to I/O Devices


I/O devices are hardware components that facilitate data exchange with the computer. They are
categorized based on data transfer methods, speed, and functionality.

Types of I/O Devices


• Block Devices: Handle data in fixed-size blocks (e.g., 512 bytes or 4KB). Examples: Hard
Disk Drives (HDDs), Solid-State Drives (SSDs), USB flash drives. These are suitable for
random access and large data volumes.

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 / SOLID STATE DRIVES

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.

How do HDDs work?


A Hard Disk Drive (HDD) works by using spinning disks and a moving read/write head to store
and retrieve data. Inside the HDD, there are platters coated with a magnetic material that spin at
high speeds, usually 5400 or 7200 RPM. A tiny read/write head moves across these spinning
platters without touching them, reading and writing data by detecting small magnetic charges. The
platters are divided into tracks and sectors, which act like an address system to help locate stored
information. When you save a file, the HDD records data by changing the magnetic charges at
specific locations. When you open a file, the HDD finds the correct location, and the read head
4|Page
LECTURE NOTES

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.

Features of Hard Disk Drive (HDD)


• Large Storage Capacity: HDDs can store large amounts of data, ranging from a few
gigabytes (GB) to several terabytes (TB).
• Cost-Effective: Generally cheaper than SSDs, making them an affordable option for large
data storage.
• Size: Typically larger and heavier than SSDs.
• Performance: Slower than SSDs due to mechanical parts.
• Mechanical Parts: Due to its moving parts, HDDs can be less durable than SSDs.
Advantages of HDD
• Cost-Effective: HDD is also cheaper per gigabyte comparing to SSD which is good for cost
effective storage of large amounts of data.
• High Storage Capacity: HDDs are available in higher capacities than that of Floppy disks
are available making them ideal for application by people who require large storage
facilities such as multimedia.
• Availability: HDD has a relatively long history of usage and that is why it is widely
supported by the majority of devices.
Disadvantages of HDD
• Slower Speed: Due to the mechanical design of the actuator, have relatively low I/O data
rates in comparison to SSDs.
• More Fragile: As compared to SSDs, HDDs have higher chances of getting damaged due
to physical shocks or drops this is because they have moving parts.
• Higher Power Consumption: As it is a magnetic disk that continues to spin platters, HDDs
have higher power consumption and hence are less energy efficient particularly for portable
devices.

What is Solid State Drive(SSD)?


SSDs, on the other hand, use flash memory to store data instead of a spinning disk. SSDs have no
moving parts, making them much faster, more durable, and less susceptible to mechanical failure
than HDDs.

5|Page
LECTURE NOTES

How do SSD work?


A Solid State Drive (SSD) stores and retrieves data using flash memory instead of moving parts,
making it much faster and more durable than a traditional Hard Disk Drive (HDD).

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.

Features of Solid State Drive (SSD)


• Fast Performance: SSDs offer much faster data access and transfer speeds than HDDs.
• Compact Size: SSDs are smaller and lighter than HDDs, making them an ideal option for
use in portable devices such as laptops and tablets.
• Lower Power Consumption: SSDs consume less power than HDDs, making them more
energy-efficient.
• Higher Cost: SSDs are generally more expensive than HDDs, making them a less cost-
effective option for storing large amounts of data.
• No Mechanical Parts: SSDs have no moving parts, making them more durable and less
susceptible to mechanical failure than HDDs.
Advantages of SSD
• Faster Performance: They are also significantly faster than their mechanical counterparts,
this in terms of booting up, transmitting files as well as improving on the general
performance of any device.
• Durability: Since there is no moving parts, there is low possibility of the SSDDs getting
damaged physically and as result are recommendable for use in laptops and other portable
devices.
• Lower Power Consumption: Further, SSDs are less power hungry that AT’s, which is
important in increasing battery back-up time in laptops and decreasing power consumption
in desktops.
Disadvantages of SSD
• Higher Cost: SSDs are still costlier than the HDD per unit of capacity, although the he is
reducing every now and then.
• Limited Storage Capacity: While today SSDs exist in larger capacities it should be noted
that when it comes to higher storage capacities SSDs are commonly costlier than the HDDs.
6|Page
LECTURE NOTES

2.3. Organization of I/O Functions


I/O operations can be organized in various ways to balance efficiency, CPU utilization, and
complexity.
Types/Methods
• Polling (Programmed I/O): Polling is a technique where the CPU or a controlling program
repeatedly checks the status of an input/output (I/O) device at regular intervals to see if it's
ready for an operation.
• Interrupts: Device signals CPU when ready, allowing CPU to handle other tasks.

Example: A printer interrupts the CPU when a page is done printing.


Advantages: CPU efficient; supports multitasking.
Disadvantages: Overhead from interrupt service routines (ISRs); priority management needed.
Use Cases: Keyboard input in OS, where events are sporadic.

• 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.

2.4. I/O Buffering Techniques


Buffering is a process in which the data is stored in a buffer or cache, which makes this stored data
more accessible than the original source. Buffer is an area in memory that is used to hold the data
that is being transmitted from one place to another and store the data temporarily. There are a
number of data storage devices that are used in a system, like Hard Disks, network devices, pen
drives, etc. So, there might be some waiting time faced by the processes or applications that are
attempting to access that data from the storage devices. This problem is mainly caused when the
devices from where device is slow or have low latency. The mitigation to this problem is
significantly solved using Buffering, as in this process the buffer acts as an intermediate between
the storage device and the processes/applications. In this process, the data is already transferred to
the Buffer so the data retrieval can be done from it which significantly reduces the waiting time
and hence improves the performance of the system.

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

2.5. Disk Scheduling Algorithms


Disk scheduling optimizes the order of servicing read/write requests to minimize head movement
(seek time) on block devices like HDDs. (Less relevant for SSDs due to no mechanical parts.)
Key Concepts
///

RAID (Redundant Arrays of Independent Disks)


RAID is a technique that combines multiple hard drives or SSDs into a single system to improve
performance, data safety or both. If one drive fails, data can still be recovered from the others.
In RAID (Redundant Array of Independent Disks), data is not stored on just one hard drive but is
distributed across multiple drives.
• The data is split into small blocks (like dividing a file into chunks). These blocks are written
across multiple drives in parallel.
• Mirroring (RAID 1): Exact copy of data is kept on another drive.
• Parity (RAID 5, RAID 6): A calculated value (parity block) is stored to allow data recovery
in case of failure.
• Fault Tolerance: If one drive fails, RAID uses the redundant data (mirror or parity) to
reconstruct missing data.
What is parity? Parity check?
This improves performance by allowing multiple drives to read/write data simultaneously.

What is a RAID Controller?


A RAID controller manages multiple hard drives, making them work together as one system. It
helps improve speed and adds data protection by handling drive failures. Think of it as a smart
manager that boosts performance and keeps your data safe.

11 | P a g e
LECTURE NOTES

Types of RAID Controller


There are three types of RAID controller:

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.

3. RAID-2 (Bit-Level Stripping with Dedicated Parity)


RAID-2 is a specialized RAID level that uses bit-level striping combined with error correction
using Hamming Code. In this configuration, data is distributed at the bit level across multiple
drives and a dedicated parity drive is used for error detection and correction. While it offers strong
fault tolerance, its complexity and cost make it rarely used in practice.

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.

5. RAID-4 (Block-Level Stripping with Dedicated Parity)


RAID-4 introduces block-level striping across multiple disks, combined with a dedicated parity
disk to provide fault tolerance. Data is written in blocks and a separate disk stores parity
information calculated using the XOR function. This setup allows for data recovery in case of a
single disk failure, making RAID-4 more reliable than RAID-0 but less efficient in write-intensive
scenarios due to reliance on a dedicated parity disk.

In the figure, we can observe one column (disk) dedicated to parity.


Parity is calculated using a simple XOR function. If the data bits are 0,0,0,1 the parity bit is
XOR(0,0,0,1) = 1. If the data bits are 0,1,1,0 the parity bit is XOR(0,1,1,0) = 0. A simple approach
is that an even number of ones results in parity 0 and an odd number of ones results in parity 1.

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.

6. RAID-5 (Block-Level Stripping with Distributed Parity)


RAID-5 builds on RAID-4 by distributing parity information across all disks instead of storing it
on a dedicated parity drive. This distributed parity significantly improves write performance,
especially for random write operations, while maintaining fault tolerance for single disk failures.
RAID-5 is one of the most commonly used RAID configurations due to its balance between
reliability, performance and storage efficiency.

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:

Disk 0: Data (D1, D2), Parity (P1)


Disk 1: Data (D3, D4), Parity (P2)
Disk 2: Data (D5, D6), Parity (P3)
Data Recovery: In case of a single disk failure, the missing data can be reconstructed by XOR-
ing the remaining data blocks and parity information.
Evaluation:
• Reliability: 1, RAID-5 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. This is identical to
RAID-4.
Capacity: ( N – 1 ) ∗ B (N−1)∗B, Overall, space equivalent to one disk is utilized in storing the
parity. Hence, ( N – 1 ) (N−1) disks are made available for data storage, each disk having B blocks.
Advantages:
• Data can be reconstructed using parity bits.
• It makes the performance better.
Disadvantages:
• Its technology is complex and extra space is required.
• If both discs get damaged, data will be lost forever.

7. RAID-6 (Block-Level Stripping with two Parity Bits)


RAID-6 is an advanced version of RAID-5 that provides enhanced fault tolerance by introducing
double distributed parity. This allows RAID-6 to recover from the failure of up to two disks
simultaneously, making it more reliable for critical systems with larger arrays. However, the added
parity calculations can impact write performance.

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:

Disk 0: Data (D1, D2), Parity (P1)


Disk 1: Data (D3, D4), Parity (P2)
Disk 2: Data (D5, P1), Parity (P3)
Disk 3: Parity (P2, P3), Data (D6)
Data Recovery: If one or two disks fail, the missing data can be reconstructed using the remaining
data and parity information.

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

CHAPTER THREE: FILE MANAGEMENT


3.1 Introduction to File Systems: From Interface to Implementation
File systems are a core component of operating systems (OS) that manage data storage, retrieval,
and organization on secondary storage devices like hard drives or SSDs. They provide an
abstraction layer between users/applications and physical storage, ensuring data persistence,
integrity, and efficient access. The journey from interface to implementation involves user-facing
APIs, logical structures, and low-level disk management.

Key Aspects of File management

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.

Advantages of Modern File Systems

• Enable data sharing and protection in multi-user environments.


• Optimize storage efficiency and access speed.
• Support large-scale data with features like virtualization.

Disadvantages of Modern File Systems

• Overhead from abstraction can introduce latency.


• Complexity increases vulnerability to corruption or security breaches.

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.

3.2. File System Interfaces and Structures


File system interfaces provide standardized ways to interact with files, while structures define how
data is organized internally.

File System Interfaces


These are system calls or APIs for file operations:
• Open: Prepares a file for access, returning a file descriptor (handle).
Example: In Unix, open("[Link]", O_RDONLY) opens a file for reading. It establishes context
(e.g., mode, position), supports concurrency. A disadvantage maybe failure if the file doesn't exist
or permissions deny access. A use case maybe starting a text editor session.
• Read: Transfers data from file to memory.
Example: read(fd, buffer, size) reads 'size' bytes into 'buffer'. It enables efficiency for sequential or
random access. But may lead to blocking if data not is not ready. It may also lead to potential
buffer overflows if mismanaged. A use case is Loading image data in a viewer app.
• Write: Transfers data from memory to file.
Example: write(fd, buffer, size) appends or overwrites data. It Supports creation/modification;
atomic in some systems. It may have a drawback such as Risk of data loss on failure; slower on
non-SSD storage. An example of such is Saving user input in a document.
• Close: Releases resources associated with the file descriptor. We have close(fd) flushes
buffers and frees locks. It prevents resource leaks, ensures data persistence. It causes
premature close which may cause data loss if not flushed. An example here maybe Ending
a logging session in an application.

File System Structures

• 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.

3.3. Organization of Files and Directories


20 | P a g e
LECTURE NOTES

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).

Directory Organization Types

• 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.

3.4. Secondary Storage Management


This techniques involves allocating space for files and managing free space on disks. We have

21 | P a g e
LECTURE NOTES

• Contiguous Allocation: Assigns consecutive blocks to a file.

Read on contiguous allocation

• 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.

• Indexed Allocation: Central index points to all blocks.


Example: Unix inodes with direct, single-indirect, double-indirect pointers.
Advantages: Efficient for random access; supports large files.
Disadvantages: Index block overhead; multi-level indirection slows access.
Use Cases: High-performance file systems like NTFS.

Free Space Management

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

Very relatable in ext2/3 file systems.

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

Some features of Features of FAT32


Legacy Compatibility: FAT32 has been around because the early days of computing and is
broadly supported throughout diverse operating system and devices. It is commonly used for USB
flash drives, SD playing cards, and different removable media because of its huge compatibility.
Simple Structure: FAT32 has a tremendously easy document system structure, along with a File
Allocation Table (FAT) that keeps track of report allocation at the disk. This simplicity makes it
easy to implement and understand however additionally limits its abilities compared to extra
cutting-edge document systems.
No Journaling: FAT32 does no longer help journaling, a function determined in extra superior
record systems like NTFS. Journaling allows preserve the consistency of the record in case of
sudden shutdowns or crashes by way of preserving track of changes earlier than they're devoted to
the disk.
Limited Support for Long Filenames: While FAT32 supports lengthy filenames (up to 255
characters), it uses a backward-compatible technique referred to as 8.3 report naming conference,
which restricts filenames to eight characters followed by using a three-individual record extension.

Management of FAT32 File System Disk Space


The control data is stored independently of the file system in the linked allocation that the FAT32
file system uses. Every disc block in an array has an element in the file allocation table of that disc.
A file is assigned a disc block, and the associated FAT element retains the next disc block address.
Because of the linked allocation, the disc block and its FAT component together comprise a unit
that shares the same data as the disc block. The address of the first disc block is contained in a
file's directory entry, while the address of the second disc block is contained in the FAT element
for that disc block. The final disc block contains the unique code that denotes the file's end.
Advantages of FAT32
• FAT32 efficiently works under partitions of 200 MB.
• FAT32 provides compatibility with different operating systems.
• FAT32 is frequently used as a primary partition on multiboot systems.
• Disc partitions of up to 2 TB can be made using FAT32.
Partitions formatted as FAT16 are limited to 2GB in size.
• FAT32 uses much less disc space for large partitions because the minimum cluster size for
partitions under 8GB is still a modest 4KB. Because it is compatible with several operating
systems, it is frequently used as the primary partition on multi-boot systems.
Disadvantages of FAT32
The partitions in FAT32 of size over 200 MB can degrade the performance.
• FAT32 is insecure because of the lack of encryption.
• FAT32 is susceptible to fragmentation.

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.

Management of NTFS File System Disk Space


Various disc sector size have no dependency on the NTFS file system. The cluster idea, which is a
collection of adjacent sectors, is used to allocate disc space a cluster may have up to 2n parts. A
bitmap file is used to represent the allocated and unoccupied clusters in a volume, which is a logical
partition on a disc. Unusable clusters are also tracked by a file called a bad cluster file. You can
use a volume set to surpass the partition's 32-volume maximum.
The NTFS volume contains the boot sector, the master file table (MFT), and additional user and
system data. Similar to a FAT table, the master file table (MFT) contains all of the data regarding
the files and directories on the drive. Because each volume contains a boot sector, it can all be
booted.

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

3.6. File Protection and Security Mechanisms


File protection in an operating system is the process of securing files from unauthorized access,
alteration, or deletion. It is critical for data security and ensures that sensitive information remains
confidential and secure. Operating systems provide various mechanisms and techniques such as
file permissions, encryption, access control lists, auditing, and physical file security to protect files.
Proper file protection involves user authentication, authorization, access control, encryption, and
auditing.
Types of File protection
File Permissions : File permissions are a basic form of file protection that controls access to files
by setting permissions for users and groups. File permissions allow the system administrator to
assign specific access rights to users and groups, which can include read, write, and execute
privileges. These access rights can be assigned at the file or directory level, allowing users and
groups to access specific files or directories as needed. File permissions can be modified by the
system administrator at any time to adjust access privileges, which helps to prevent unauthorized
access.
Encryption: Encryption is the process of converting plain text into ciphertext to protect files from
unauthorized access. Encrypted files can only be accessed by authorized users who have the correct
encryption key to decrypt them. Encryption is widely used to secure sensitive data such as financial
information, personal data, and other confidential information. In an operating system, encryption
can be applied to individual files or entire directories, providing an extra layer of protection against
unauthorized access.
Access Control Lists (ACLs) : Access control lists (ACLs) are lists of permissions attached to
files and directories that define which users or groups have access to them and what actions they
can perform on them. ACLs can be more granular than file permissions, allowing the system
administrator to specify exactly which users or groups can access specific files or directories. ACLs
can also be used to grant or deny specific permissions, such as read, write, or execute privileges,
to individual users or groups.
Auditing and Logging: Auditing and logging are mechanisms used to track and monitor file
access, changes, and deletions. It involves creating a record of all file access and changes,
including who accessed the file, what actions were performed, and when they were performed.
Auditing and logging can help to detect and prevent unauthorized access and can also provide an
audit trail for compliance purposes.
Physical File Security: Physical file security involves protecting files from physical damage or
theft. It includes measures such as file storage and access control, backup and recovery, and
physical security best practices. Physical file security is essential for ensuring the integrity and
availability of critical data, as well as compliance with regulatory requirements.

29 | P a g e
LECTURE NOTES

CHAPTER FOUR: UNDERSTANDING DEADLOCKS


A deadlock is a situation in a computing environment where a set of processes gets permanently
stuck because each process is waiting for a resource held by another process, and none of them
can proceed. A process in an operating system typically uses resources in the following THREE
sequences:

• Request a resource
• Use the resource
• Release the resource
Deadlock arises when processes hold some resources while waiting for others.

Example:

Process P1 holds Resource R1 and requests R2.


Process P2 holds Resource R2 and requests R1.
Neither process can proceed causing a deadlock.

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:

P0 executes wait(A) and preempts.


P1 executes wait(B).
Now P0 and P1 enter in deadlock.

Draw a diagram to illustrate this


3. Assume the space is available for allocation of 200K bytes, and the following sequence of events
occurs.

30 | P a g e
LECTURE NOTES

P0 P1
Request 80KB Request 70KB
Request 60KB Request 80KB

Deadlock occurs if both processes progress to their second request.

Necessary Conditions for Deadlock in OS


Deadlock can arise if the following four conditions hold simultaneously (Necessary Conditions)

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.

• P1 is holding R1 and waiting for R2 (which is held by P2).


• P2 is holding R2 and waiting for R3 (which is held by P3).
• P3 is holding R3 and waiting for R4 (which is held by P4).
• P4 is holding R4 and waiting for R1 (which is held by P1).

Safe State and Unsafe State


A safe state refers to a system state where the allocation of resources to each process ensures the
avoidance of deadlock. The successful execution of all processes is achievable, and the likelihood
of a deadlock is low. The system attains a safe state when a suitable sequence of resource allocation
enables the successful completion of all processes.

31 | P a g e
LECTURE NOTES

Deadlock Avoidance Algorithms


When resource categories have only single instances of their resources, Resource- Allocation
Graph Algorithm is used. In this algorithm, a cycle is a necessary and sufficient condition for
deadlock. When resource categories have multiple instances of their resources, Banker's Algorithm
is used. In this algorithm, a cycle is a necessary but not a sufficient condition for deadlock.

• Resource-Allocation Graph Algorithm


Resource Allocation Graph (RAG) is a popular technique used for deadlock avoidance. It is a
directed graph that represents the processes in the system, the resources available, and the
relationships between them. A process node in the RAG has two types of edges, request edges, and
assignment edges. A request edge represents a request by a process for a resource, while an
assignment edge represents the assignment of a resource to a process. To determine whether the
system is in a safe state or not, the RAG is analyzed to check for cycles. If there is a cycle in the
graph, it means that the system is in an unsafe state, and granting a resource request can lead to a
deadlock. In contrast, if there are no cycles in the graph, it means that the system is in a safe state,
and resource allocation can proceed without causing a deadlock. The RAG technique is
straightforward to implement and provides a clear visual representation of the processes and
resources in the system. It is also an effective way to identify the cause of a deadlock if one occurs.
However, one of the main limitations of the RAG technique is that it assumes that all resources in
the system are allocated at the start of the analysis. This assumption can be unrealistic in practice,
where resource allocation can change dynamically during system operation. Therefore, other
techniques such as the Banker's Algorithm are used to overcome this limitation.

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.

4. Check if the system is in a safe state


Simulate the allocation of the requested resources to the process. Check if this allocation results in
a safe state, meaning there is a sequence of allocations that can satisfy all processes without leading
to a deadlock. If the state is safe, grant the request by updating the allocation matrix and the need
matrix. If the state is not safe, do not grant the request and let the process wait.
Release the Resources
When a process has finished its execution, releases its allocated resources by updating the
allocation matrix and the need matrix. The above steps are repeated for each resource request made
by any process in the system. Overall, the Banker's algorithm is an effective way to avoid

33 | P a g e
LECTURE NOTES

deadlocks in resource constrained systems by carefully managing resource allocations and


predicting potential conflicts before they arise.

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:

1. Eliminate Mutual Exclusion


Some resources, like a printer, are inherently non-sharable, so this condition is difficult to break.
However, sharable resources like read-only files can be accessed by multiple processes at the same
time.
For non-sharable resources, prevention through this method is not possible.
2. Eliminate Hold and Wait
Hold and wait is a condition in which a process holds one resource while simultaneously waiting
for another resource that is being held by a different process. The process cannot continue until it
gets all the required resources.

There are two ways to eliminate hold and wait:


By eliminating wait: The process specifies the resources it requires in advance so that it does not
have to wait for allocation after execution starts.

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

CHAPTER FIVE : MULTI-PROCESSOR AND DISTRUBUTED


SYSTEM

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

1)Time shared common bus


2)Multiport memories
3)Crossbar switch network

1)Time shared common bus

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

3)Crossbar switch network


Here, we use multiport unlike in multiport memories, a switch will be installed between memory
unit and CPU. The switch is responsible for determining whether to pass the request to a particular
memory module or not based on the request made for.

38 | P a g e
LECTURE NOTES

The advantage here is ;


• High data through rate.
Disadvantages may include
• Complex to implement as more switches involved.
• Costlier to implement.

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).

Benefits of using a Multiprocessor


• Enhanced performance.
• Multiple applications.
• Multi-tasking inside an application.
• High throughput and responsiveness.
• Hardware sharing among CPUs.

39 | P a g e
LECTURE NOTES

----Read on the pros and cons of multiprocessor systems-----

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.

Difference between multiprocessor and Multicomputer:

• 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

How does Virtualization work?


Virtualizations uses special software known as hypervisor, to create many virtual computers
(cloud instances) on one physical computer. The Virtual Machines behave like actual computers
but use the same physical machine.

• Virtual Machines (Cloud Instances)


After installing virtualization software, you can create one or more virtual machines on your
computer. Virtual machines (VMs) behave like regular applications on your system.
The real physical computer is called the Host, while the virtual machines are called Guests.
A single host can run multiple guest virtual machines. Each guest can have its own operating
system, which may be the same or different from the host OS. Every virtual machine functions
like a standalone computer, with its own settings, programs, and configuration. VMs access system
resources such as CPU, RAM, and storage, but they work as if they are using their own hardware.

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

There exist two categories of hypervisors;

• Type 1 Hypervisor (Bare-Metal Hypervisor)


The hypervisor is installed directly onto the computer hardware, without an operating system
sitting in between. It is highly efficient as it has a direct access to the resources of the computer.
• Type 2 Hypervisor:
It is run over an installed operating system (such as Windows or macOS).
It's employed when you need to execute more than one operating system on one machine.
Types of Virtualization
• Application Virtualization
• Network Virtualization
• Desktop Virtualization
• Storage Virtualization
• Server Virtualization
• Data virtualization

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.

Difference between centralized system and distributed system


All data and computational resources are kept and controlled in a single central place, such as a
server, in a centralized system. Applications and users connect to this hub in order to access and
handle data. Although this configuration is easy to maintain and secure, if too many users access
it simultaneously or if the central server malfunctions, it could become a bottleneck.

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.

Architectures of Distributed systems


Below are some of the common distributed system architectures:

• 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

Example of a Distributed System


Any Social Media can have its Centralized Computer Network as its Headquarters and computer
systems that can be accessed by any user and using their services will be the Autonomous Systems
in the Distributed System Architecture.

• Distributed System Software: This Software enables computers to coordinate their


activities and to share the resources such as Hardware, Software, Data, etc.
• Database: It is used to store the processed data that are processed by each Node/System of
the Distributed systems that are connected to the Centralized network.

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.

Disadvantages of Distributed System

• 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

Use cases of Distributed System


• Finance and Commerce: Amazon, eBay, Online Banking, E-Commerce websites.
• Information Society: Search Engines, Wikipedia, Social Networking, Cloud Computing.
• Cloud Technologies: AWS, Salesforce, Microsoft Azure, SAP.
• Entertainment: Online Gaming, Music, youtube.
• Healthcare: Online patient records, Health Informatics.
• Transport and logistics: GPS, Google Maps.

Are Distributed Systems and Microservices the Same?


Distributed systems and microservices are related concepts but not the same. Let's break down the
differences:

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

You might also like