Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

UNIT-3

Distributed System (BIT-43)

Distributed File System (DFS)


A Distributed File System (DFS) as the name suggests, is a file system that is distributed
on multiple file servers or multiple locations. It allows programs to access or store isolated
files as they do with the local ones, allowing programmers to access files from any network
or computer.
The main purpose of the Distributed File System (DFS) is to allows users of physically
distributed systems to share their data and resources by using a Common File System. A
collection of workstations and mainframes connected by a Local Area Network (LAN) is a
configuration on Distributed File System. A DFS is executed as a part of the operating
system. In DFS, a namespace is created and this process is transparent for the clients.
DFS has two components:
 Location Transparency –
Location Transparency achieves through the namespace component.
 Redundancy –
Redundancy is done through a file replication component.

In the case of failure and heavy load, these components together improve data availability by
allowing the sharing of data in different locations to be logically grouped under one folder,
which is known as the “DFS root”.
It is not necessary to use both the two components of DFS together, it is possible to use the
namespace component without using the file replication component and it is perfectly
possible to use the file replication component without using the namespace component
between servers.

Working of DFS :
There are two ways in which DFS can be implemented:
 Standalone DFS namespace –

It allows only for those DFS roots that exist on the local computer and are not using
Active Directory. A Standalone DFS can only be acquired on those computers on
which it is created. It does not provide any fault liberation and cannot be linked to any
other DFS. Standalone DFS roots are rarely come across because of their limited
advantage.
 Domain-based DFS namespace –

It stores the configuration of DFS in Active Directory, creating the DFS namespace
root accessible at \\<domainname>\<dfsroot> or \\<FQDN>\<dfsroot>
Advantages :

 DFS allows multiple user to access or store the data.


 It allows the data to be share remotely.
 It improved the availability of file, access time, and network efficiency.
 Improved the capacity to change the size of the data and also improves the ability
to exchange the data.
 Distributed File System provides transparency of data even if server or disk fails.

Disadvantages :

 In Distributed File System nodes and connections needs to be secured therefore


we can say that security is at stake.
 There is a possibility of lose of messages and data in the network while movement
from one node to another.
 Database connection in case of Distributed File System is complicated.
 Also handling of the database is not easy in Distributed File System as compared
to a single user system.
 There are chances that overloading will take place if all nodes tries to send data at
once.

Mechanism for Building Distributed file system

Distributed Systems are the systems that make a single system image to users of the networks.
The failure of one system in the network will not be coming to the picture of all other uses.
Here, all the systems act in a dual role such as both client as well as server.
The distributed File system provides a similar abstraction to the users of a distributed
system and makes it convenient for them to use files in a distributed environment.
Characteristic of distributed file system.
 Remote data/file sharing: It allows a file to be transparently accessed by
processes of any node of the system irrespective of the file’s location. Example:
Any process ‘A’ can create the file and share it with other processes ‘B’ or ‘C’
and the same file can be accessed/modified process running in other nodes.
 User mobility: Users in the distributed systems are allowed to work in any
system at any time. So, users need not relocate secondary storage devices in
distributed file systems.
 Availability: Distributed file systems keep multiple copies of the same file in
multiple places. Hence, the availability of the distributed file system is high and
it maintains a better fault tolerance for the system.
 Data Integrity: A file system is typically shared by several users. Data saved in
a transferred file must have its integrity protected by the file system. The correct
synchronisation of concurrent access requests from multiple users vying for
access to the same file requires a concurrency control method. Atomic
transactions, which are high-level concurrency management systems for data
integrity, are frequently made available to users by file systems.
 Performance: Performance is evaluated using the typical amount of time it
takes to persuade a client. It must function in a manner comparable to a centralised
file system.
 Diskless workstations: Distributed file systems allow the use of diskless
workstations to reduce noise and heat in the system. Also, diskless workstations
are more economical than disk full workstations.

Desirable features to build distributed file system

 Scalable networks: Even with an increase in the number of users in the


network, the performance should remain the same. For example, initially, 100
users are using 100 Mbps bandwidth networks and suddenly system admin
increased the number of users to 150, in that case, the performance of the network
remains the same.
 Replications: The services should be replicated in many systems to avoid a
single point of failure. For example, an email server should be available in
multiple systems to reach the service to users 24×7.
 Openness: The systems with different architecture as well as operating systems
can be connected to the distributed system environment and thus message passing
is possible. The person with a 32-bit system can interact with the person with a
64-bit system seamless interaction.
 Reliable and Availability: The systems should be built with 100% reliability
and 100% availability for the utilization of networks.

Mechanism to build distributed file systems

 Use of FIle Models: The DFS uses different conceptual models of a file. The
following are the two basic criteria for file modeling, which include file structure
and modifiability. The files can be unstructured or structured based on the
applications used in file systems. Also, the modifiability of the file can be
categorized as mutable and immutable files.
 Use of FIle Accessing Models: A distributed file system may use one of the
following models to service a client’s file access request when the accessed file is
a remote file. There are two such models are there, viz., the Remote service model
and the Data-caching model.
 Use of FIle sharing Semantics: A shared file may be simultaneously accessed
by multiple users. The types of file-sharing semantics can be used such as Unix
Semantics, Session Semantics, Immutable shared files semantics, and transaction-
like semantics.
 Use of FIle -Caching Schemes: Basically following key criteria used in file
caching scheme viz., cache location, modification propagation, and cache
validation
 Use of FIle Replications: File replication is the primary mechanism for
improving file availability in a distributed systems environment. A replicated file
is a file that has multiple copies with each copy located on a separate file server.

Issues in Distributed Systems


 the lack of global knowledge.
 naming.
 scalability.
 compatibility.
 process synchronization (requires global knowledge)
 resource management (requires global knowledge)
 security.
 fault tolerance, error recovery.

Network File System (NFS)

The advent of distributed computing was marked by the introduction of distributed file
systems. Such systems involved multiple client machines and one or a few servers. The server
stores data on its disks and the clients may request data through some protocol messages.

Advantages of a distributed file system:

 Allows easy sharing of data among clients.


 Provides centralized administration.
 Provides security, i.e. one must only secure the servers to secure data.

Distributed File System Architecture:


Even a simple client/server architecture involves more components than the physical file
systems discussed previously in OS. The architecture consists of a client-side file system and
a server-side file system. A client application issues a system call (e.g. read(), write(),
open(), close() etc.) to access files on the client-side file system, which in turn retrieves files
from the server. It is interesting to note that to a client application, the process seems no
different than requesting data from a physical disk, since there is no special API required to
do so. This phenomenon is known as transparency in terms of file access. It is the client-
side file system that executes commands to service these system calls. For instance, assume
that a client application issues the read() system call.

Sun’s Network File System


The earliest successful distributed system could be attributed to Sun Microsystems, which
developed the Network File System (NFS). NFSv2 was the standard protocol followed for
many years, designed with the goal of simple and fast server crash recovery. This goal is of
utmost importance in multi-client and single-server based network architectures because a
single instant of server crash means that all clients are unserviced. The entire system goes
down. Stateful protocols make things complicated when it comes to crashes. Consider a
client A trying to access some data from the server. However, just after the first read, the
server crashed.
: NFS implements a stateless protocol. File Handles: NFS uses file handles to uniquely
identify a file or a directory that the current operation is being performed upon. This consists
of the following components

 Volume Identifier – An NFS server may have multiple file systems or


partitions. The volume identifier tells the server which file system is being
referred to.
 Inode Number – This number identifies the file within the partition.
 Generation Number – This number is used while reusing an inode number.

File Attributes: “File attributes” is a term commonly used in NFS terminology. This is a
collective term for the tracked metadata of a file, including file creation time, last modified,
size, ownership permissions etc. This can be accessed by calling stat() on the file. NFSv2

Protocol: Some of the common protocol messages are listed below.

Message Description

NFSPROC_GETATTR Given a file handle, returns file attributes.

NFSPROC_SETATTR Sets/updates file attributes.

Given file handle and name of the file to look up, returns file
NFSPROC_LOOKUP
handle.
Message Description

Given file handle, offset, count data and attributes, reads the
NFSPROC_READ
data.

Given file handle, offset, count data and attributes, writes data
NFSPROC_WRITE
into the file.

Given the directory handle, name of file and attributes, creates


NFSPROC_CREATE
a file.

NFSPROC_REMOVE Given the directory handle and name of file, deletes the file.

Given directory handle, name of directory and attributes,


NFSPROC_MKDIR
creates a new directory.

Sprite File System (SFS)


A Sprite File System (SFS) is a method used in computer graphics and game development to
efficiently store and manage sprite assets. Sprites are typically 2D images or animations used
in games, simulations, or other interactive applications.
Here's a detailed breakdown of how a Sprite File System might work:
1. File Organization: The SFS organizes sprite assets in a hierarchical structure similar to a
traditional file system. It may include directories to categorize sprites based on their type,
theme, or purpose.

2. Sprite Formats: The SFS supports various sprite formats, such as PNG, JPEG, GIF, or
proprietary formats optimized for performance and storage efficiency. Each sprite file contains
the graphical data necessary to render the sprite, including pixel information, transparency data,
and metadata.

3. Metadata: Each sprite file may contain metadata providing additional information about the
sprite, such as its dimensions, position, animation frames, collision properties, and other
attributes relevant to its usage in the game or application.

4. Compression and Optimization: To minimize storage space and optimize loading times,
the SFS may employ compression techniques tailored for graphical data. Compression
algorithms like zlib or LZMA can be used to reduce the size of sprite files without significant
loss of quality. Additionally, the SFS may optimize sprite assets for specific target platforms or
display resolutions.

5. Texture Atlases: In many cases, sprites are combined into texture atlases or sprite sheets to
further optimize rendering performance. Texture atlases pack multiple sprites into a single
image, reducing the number of texture swaps during rendering and improving GPU efficiency.

6. Runtime Loading and Caching: The SFS provides functionality for loading sprite assets
at runtime as needed by the application. This allows for dynamic loading of sprites during
gameplay or level transitions, reducing initial loading times and memory usage. Additionally,
the SFS may implement caching mechanisms to store frequently accessed sprite data in
memory for faster retrieval.

7. Version Control and Collaboration: For collaborative projects, the SFS may integrate with
version control systems like Git or Subversion to track changes to sprite assets over time and
facilitate collaboration among team members. Version control ensures that changes to sprite
assets are documented, reversible, and synchronized across multiple development
environments.

8. Cross-Platform Compatibility: The SFS is designed to be cross-platform, supporting


multiple operating systems, game engines, and development environments. It provides APIs
and tools for accessing sprite assets from various programming languages and platforms,
ensuring consistency and compatibility across different environments.

Overall, a Sprite File System plays a crucial role in managing sprite assets efficiently,
optimizing performance, and streamlining the development workflow in graphics-intensive
applications and games.

Log-Structured File System (LFS)

Log-Structured File Systems were introduced by Rosenblum and Ousterhout in the early 90’s
to address the following issues.

 Growing system memories: With growing disk sizes, the amount of data that
can be cached also increases. Since reads are serviced by the cache, the file system
performance begins to depend solely on its write performance.
 Sequential I/O performance trumps over random I/O performance: Over
the years, the bandwidth of accessing bits off the hard drive has increased because
more bits can be accommodated over the same area. However, it is physically
difficult for the small rotors to move the disk more quickly. Therefore, sequential
access can improve disk performance significantly.
 Inefficiency of existing file systems: Existing file systems perform a large
number of writes for as much as creating a new file, including inode, bitmap and
data block writes and subsequent updates. The short seeks and rotational delays
incurred reduces bandwidth.
 File systems are not RAID-aware: Further, file systems do not have any
mechanism to counter the small-write problem in RAID-4 and RAID-5.
Even though processor speeds and main memory sizes have increased at an exponential rate,
disk access costs have evolved much more slowly. This calls for a file system which focusses
on write performance, makes use of the sequential bandwidth, and works efficiently on both
disk writes as well as metadata updates. This is where the motivation is Log-Structured File
System (LFS) is rooted.
The following are the data structures used in the LFS implementation.
 Inodes: As in Unix, inodes contain physical block pointers to files.
 Inode Map: This table indicates the location of each inode on the disk. The
inode map is written in the segment itself.
 Segment Summary: This maintains information about each block in the segment.
 Segment Usage Table: This tells us the amount of data on a block.

Disk Space Management System (DSMS)


A Disk Space Management System (DSMS) is a software component or set of tools designed
to efficiently manage disk space on storage devices such as hard disk drives (HDDs), solid-
state drives (SSDs), or network-attached storage (NAS) systems. The primary goals of a DSMS
include optimizing disk space utilization, ensuring data availability and reliability, and
minimizing maintenance overhead. Here's an outline of key components and functionalities
typically found in a DSMS:

1. File System Analysis:


- File System Scanning: Regularly scan the file system to collect information about disk space
usage, file sizes, and file types.
- Storage Statistics: Generate reports and statistics to provide insights into disk space
utilization trends, largest files, and storage distribution across directories.
2. Capacity Planning:
- Forecasting: Analyze historical usage data to forecast future storage requirements and plan
for capacity expansion or optimization.
- Threshold Monitoring: Set thresholds for disk space utilization levels and receive alerts
when storage capacity approaches or exceeds predefined limits.
3. Storage Optimization:
- Duplicate File Detection: Identify and eliminate duplicate files or redundant data to reclaim
disk space and reduce storage costs.
- Compression: Implement data compression techniques to reduce the size of files and
optimize storage efficiency without sacrificing data integrity.
- Data Deduplication: Identify and eliminate duplicate data blocks within files or across
multiple files to reduce storage overhead and improve efficiency.
4. Data Lifecycle Management:
- Tiered Storage: Implement tiered storage strategies to automatically migrate data between
different storage tiers based on access frequency, age, or importance.
- Archiving: Archive infrequently accessed or historical data to secondary storage systems or
long-term storage media to free up primary storage space.
- Data Retention Policies: Define policies for data retention, expiration, and deletion to ensure
compliance with regulatory requirements and optimize storage usage.
5. Space Reclamation:
- Unused File Identification: Identify and remove unused or obsolete files, temporary files,
and cache data to reclaim disk space.
- Trash Management: Manage a trash or recycle bin for deleted files to allow for easy
recovery and prevent accidental data loss.
6. Performance Optimization:
- Defragmentation: Perform disk defragmentation to optimize file placement and improve
disk access performance.
- Disk Cleanup: Remove temporary files, log files, and other unnecessary data to improve
system performance and responsiveness.
7. Data Protection:
- Backup and Recovery: Implement backup and recovery mechanisms to protect against data
loss due to hardware failures, human errors, or malicious activities.
- Data Integrity Checks: Perform regular integrity checks and data scrubbing to detect and
repair data corruption or bit rot.
8. User Interface and Automation:
- Graphical Interface: Provide a user-friendly interface for administrators to monitor disk
space usage, configure policies, and perform management tasks.
- Automation: Support automation capabilities through scripting or APIs to enable batch
operations, scheduling, and integration with other systems or tools.
By integrating these components and functionalities, a Disk Space Management System can
effectively address the challenges of managing disk space in modern storage environments,
helping organizations optimize storage resources, improve performance, and ensure data
availability and integrity.
Distributed shared memory

DSM is a mechanism that manages memory across multiple nodes and makes inter-process
communications transparent to end-users. The applications will think that they are running
on shared memory. DSM is a mechanism of allowing user processes to access shared data
without using inter-process communications. In DSM every node has its own memory and
provides memory read and write services and it provides consistency protocols. The
distributed shared memory (DSM) implements the shared memory model in distributed
systems but it doesn’t have physical shared memory. All the nodes share the virtual address
space provided by the shared memory model. The Data moves between the main memories
of different nodes.

Types of Distributed shared memory

On-Chip Memory:

 The data is present in the CPU portion of the chip.


 Memory is directly connected to address lines.
 On-Chip Memory DSM is expensive and complex.

Bus-Based Multiprocessors:

 A set of parallel wires called a bus acts as a connection between CPU and
memory.
 accessing of same memory simultaneously by multiple CPUs is prevented by
using some algorithms
 Cache memory is used to reduce network traffic.

Ring-Based Multiprocessors:

 There is no global centralized memory present in Ring-based DSM.


 All nodes are connected via a token passing ring.
 In ring-bases DSM a single address line is divided into the shared area.
Advantages of Distributed shared memory

 Simpler abstraction: Programmer need not concern about data movement, As


the address space is the same it is easier to implement than RPC.
 Easier portability: The access protocols used in DSM allow for a natural
transition from sequential to distributed systems. DSM programs are portable as
they use a common programming interface.
 locality of data: Data moved in large blocks i.e. data near to the current memory
location that is being fetched, may be needed future so it will be also fetched.
 on-demand data movement: It provided by DSM will eliminate the data
exchange phase.
 larger memory space: It provides large virtual memory space, the total memory
size is the sum of the memory size of all the nodes, paging activities are reduced.
 Better Performance: DSM improve performance and efficiency by speeding up
access to data.
 Flexible communication environment: They can join and leave DSM system
without affecting the others as there is no need for sender and receiver to existing,
 process migration simplified: They all share the address space so one process
can easily be moved to a different machine.

Apart from the above-mentioned advantages, DSM has furthermore advantages like:
 Less expensive when compared to using a multiprocessor system.
 No bottlenecks in data access.
 Scalability i.e. Scales are pretty good with a large number of nodes.

Algorithm for implementing Distributed Shared Memory


Distributed shared memory(DSM) system is a resource management component of
distributed operating system that implements shared memory model in distributed system
which have no physically shared memory. The shared memory model provides a virtual
address space which is shared by all nodes in a distributed system.
The central issues in implementing DSM are:
 how to keep track of location of remote data.
 how to overcome communication overheads and delays involved in execution of
communication protocols in system for accessing remote data.
 how to make shared data concurrently accessible at several nodes to improve
performance.

Algorithms to implement DSM

1. Central Server Algorithm:

 In this, a central server maintains all shared data. It services read requests from other
nodes by returning the data items to them and write requests by updating the data and
returning acknowledgement messages.
 Time-out can be used in case of failed acknowledgement while sequence number can
be used to avoid duplicate write requests.
 It is simpler to implement but the central server can become bottleneck and to
overcome this shared data can be distributed among several servers. This distribution
can be by address or by using a mapping function to locate the appropriate server.

2. Migration Algorithm:

 In contrast to central server algo where every data access request is forwarded to
location of data while in this data is shipped to location of data access request which
allows subsequent access to be performed locally.
 It allows only one node to access a shared data at a time and the whole block
containing data item migrates instead of individual item requested.
 It is susceptible to thrashing where pages frequently migrate between nodes while
servicing only a few requests.
 This algo provides an opportunity to integrate DSM with virtual memory provided by
operating system at individual nodes.
3. Read Replication Algorithm:

 This extends the migration algorithm by replicating data blocks and allowing multiple
nodes to have read access or one node to have both read write access.
 It improves system performance by allowing multiple nodes to access data
concurrently.
 The write operation in this is expensive as all copies of a shared block at various nodes
will either have to invalidated or updated with the current value to maintain
consistency of shared data block.
 DSM must keep track of location of all copies of data blocks in this.

4. Full Replication Algorithm:

 It is an extension of read replication algorithm which allows multiple nodes to have


both read and write access to shared data blocks.
 Since many nodes can write shared data concurrently, the access to shared data must
be controlled to maintain it’s consistency.
 To maintain consistency, it can use a gap free sequences in which all nodes wishing
to modify shared data will send the modification to sequencer which will then
assign a sequence number and multicast the modification with sequence number to
all nodes that have a copy of shared data item.
Memory Coherence:
 The set of allowable memory access orderings forms the memory consistency model.
 A memory is coherent if the value returned by a read operation is always the value that
the programmer expected.
o Strict consistency model is typical in uniprocessor: a read returns the most
recent written value.
o it is very costly to enforce the strict consistency model in distributed systems:
how to determine last write?
o To improve performance, we need relax memory consistency model.

Relax memory consistency model

 sequential consistency: the result of any execution of the operations of all the processors
is the same as if they were executed in a sequential order.
 General Consistency: All the copies of a memory location eventually contain the same
data when all the writes issues by every processor have completed.
 Weak consistency: synchronization accesses are sequentially consistent. All data access
must be performed before each synchronization.
 Other consistency models: general consistency, processor consistency, release
consistency.

Coherence Protocols
 The needs to make the data replicas consistent
 Two types of basic protocols
o Write-Invalidate Protocol: a write to a shared data causes the invalidation of all
copies except one before the write.
o Write-Update Protocol: A write to a share data causes all copies of that data to
be updated.
o Case Study: Cache coherence in the PLUS system.

Write update protocol

 General consistency
 Unit of replication: a page (4KB)
 Coherence maintenance in the unit of one word
 A virtual page is PLUS corresponds to a list of replicas, one of the replica is the master
copy. The locations of other replicas are maintained through a distributed link list (copy
list)(Figure 10.6)
 On a read fault: if local memory, read local memory. Otherwise, send request a
specified remote node and get the data
 For write: First update the master copy and then propagated to the copies linked by the
copy list. On a write fault, if the address indicates a remote node, the update request is
sent to the remote node. If the copy is not the master copy, the update request is sent
to the nod containing the master copy for updating and then further propagation.
 write is nonblocking.
 read is blocked when all writes completes.
 write-fence is used to flush all previous writes.
Granularity

 Granularity: size of the shared memory unit


 the page size is usually a multiple of the size provided by the underlying hardware
and memory management system.
 large page size -- more locality, less communication overheads, more contention,
more false sharing
 separate the unit of replication and the unit for coherence maintenance.

Page replacement

 least recently used (LRU) may not be appropriate -- data can be accessed in different
mode: shared, private, read-only, writable, etc.
 replacement policy needs to take access modes into consideration.e.g. private data
should be replaced before shared data. READ-only page can just be deleted.

Scheduling Distributed System

Scheduling in Distributed Systems:

The techniques that are used for scheduling the processes in distributed systems are as
follows:
1. Task Assignment Approach: In the Task Assignment Approach, the user-submitted
process is composed of multiple related tasks which are scheduled to appropriate
nodes in a system to improve the performance of a system as a whole.
2. Load Balancing Approach: In the Load Balancing Approach, as the name implies,
the workload is balanced among the nodes of the system.
3. Load Sharing Approach: In the Load Sharing Approach, it is assured that no node
would be idle while processes are waiting for their processing.

Characteristics of a Good Scheduling Algorithm:

The following are the required characteristics of a Good Scheduling Algorithm:


 The scheduling algorithms that require prior knowledge about the properties and
resource requirements of a process submitted by a user put a burden on the user.
Hence, a good scheduling algorithm does not require prior specification regarding
the user-submitted process.
 A good scheduling algorithm must exhibit the dynamic scheduling of processes
as the initial allocation of the process to a system might need to be changed with
time to balance the load of the system.
 The algorithm must be flexible enough to process migration decisions when there
is a change in the system load.
 The algorithm must possess stability so that processors can be utilized optimally.
It is possible only when thrashing overhead gets minimized and there should no
wastage of time in process migration.
 An algorithm with quick decision making is preferable such as heuristic methods
that take less time due to less computational work give near-optimal results in
comparison to an exhaustive search that provides an optimal solution but takes
more time.
 A good scheduling algorithm gives balanced system performance by maintaining
minimum global state information as global state information (CPU load) is
directly proportional to overhead. So, with the increase in global state information
overhead also increases.
 The algorithm should not be affected by the failure of one or more nodes of the
system. Furthermore, even if the link fails and nodes of a group get separated into
two or more groups then also it should not break down. So, the algorithm must
possess decentralized decision-making capability in which consideration is given
only to the available nodes for taking a decision and thus, providing fault tolerance

You might also like