Anda di halaman 1dari 18

Chapter 11: File System Implementation

Allocation Methods
An allocation method refers to how disk blocks are

allocated for files:


Contiguous allocation

Linked allocation
Indexed allocation

Contiguous Allocation
Each file occupies a set of contiguous blocks on

the disk
Simple only starting location (block #) and length

(number of blocks) are required


Random access Wasteful of space (dynamic storage-allocation

problem)
File can not grow. External Fragmentation

Contiguous Allocation of Disk Space

Linked Allocation

Linked Allocation
Each file is a linked list of disk block; the disk blocks may be

scattered anywhere on the disk.


The directory contains a pointer to the first and last blocks of

the file.
For example, a file of five blocks might start at block 9,

continue at block 16, then block 1, block 10 and finally block 25.
Each block contains a pointer to the next block. These pointers are not made available to the user. To create a new file, we simply create a new entry in the

directory.
With linked allocation, each directory entry has a pointer to

the first disk block of the file.


This pointer is initialized to nil (the end of list pointer value) to

signify an empty file.

Advantages of linked Allocation


There is no external fragmentation with linked

allocation, and any free block on the free space list can be used to satisfy a request.
The size of a file does not need to be declared

when that file is created.


A file can continue to grow as long as free blocks

are available.
Consequently, it is never necessary to compact

disk space.

Disadvantages of Linked Allocation


The major problem is that it can be used effectively

only for sequential access files.


To find the ith block of a file, we must start at the

beginning of that file and follow the pointers until we get to the ith block.
Another disadvantage to linked allocation is the

space required for the pointers.

Indexed Allocation
Brings all pointers together into the index block. Logical view.

index table

Example of Indexed Allocation

Index Allocation
All the pointers are brought together into one location : Index

Block.
Each file has its own index block, which is an array of disk-block

addresses.
The ith entry in the index block points to the ith block of the file. The directory contains the address of the index block. To read the ith block, we use the pointer in the ith index-block

entry to find and read the desired block.


Index allocation supports direct access, without suffering from

external fragmentation, because any free block on the disk may satisfy a request for more space.
The pointer overhead of the index block is generally greater

than pointer overhead of linked allocation so it also results in wastage of space.

Symbolic Link
A link is effectively a pointer or an alias to another

file or subdirectory. For example, a link may be implemented as an absolute or relative path name (a symbolic link).
When a reference to a file is made, we search the

directory. The directory entry is marked as a link and the name of the real file (or directory) is given.
We resolve the link by using the path name to

locate the real file. Links are easily identified by their format in the directory entry.
A symbolic link can be deleted without deleting the

actual file it links.

Distributed-File Systems
Distributed

file system (DFS) a distributed implementation of the classical time-sharing model of a file system, where multiple users share files and storage resources. sharing when files are physically dispersed among the sites of a distributed system.

The purpose of a DFS is to support the same kind of

DFS Structure
Service software entity running on one or more

machines and providing a particular type of function to a priori unknown clients


Server service software running on a single

machine
Client process that can invoke a service using a

set of operations that forms its client interface


A client interface for a file service is formed by a

set of primitive file operations (create, delete, read, write)


Client interface of a DFS should be transparent,

i.e., not distinguish between local and remote files

Naming and Transparency


Naming mapping between logical and physical

objects
Multilevel mapping abstraction of a file that

hides the details of how and where on the disk the file is actually stored
A transparent DFS hides the location where in the

network the file is stored


For a file being replicated in several sites, the

mapping returns a set of the locations of this files replicas; both the existence of multiple copies and their location are hidden

Naming Structures
Location transparency file name does not reveal

the files physical storage location


Location independence file name does not need

to be changed when the files physical storage location changes

File Replication
Replicas

of the same independent machines

file

reside

on

failure-

Improves availability and can shorten service time.

Replication of files on different machines is a useful

redundancy for improving availability.


It is desirable to hide the details of replication from

users.
The main problem associated with replicas is their

update.
From a users point of view, replicas of a file denote

the same logical entity and thus an update to any replica must be reflected on all other replicas.

End of Chapter

Anda mungkin juga menyukai