Please enable JavaScript.
Coggle requires JavaScript to display documents.
TOPIC 3 : FILE MANAGEMENT PART 2 - Coggle Diagram
TOPIC 3 : FILE MANAGEMENT PART 2
Wardina
File Allocation Method
&
Benefits & Weaknesses
Linked file allocation
each file is a linked list of disk blocks, the disk blocks may be scattered anywhere on the disk.
the directory contains a pointer to the first and last blocks of the file
each block contains a pointer to the next block.
Benefits
In terms of the file size, this scheme is very flexible.
We can easily increase or decrease the file size and system does not worry about the contiguous chunks of memory.
This method free from external fragmentation this makes it better in terms of memory utilization.
a directory entry only comprises of the starting block address.
Weaknesses
In this scheme, there is large no of seeks because the file blocks are randomly distributed on disk.
Linked allocation is comparatively slower than contiguous allocation.
Random or direct access is not supported by this scheme we cannot access the blocks directly.
The pointer is extra overhead on the system due to the linked list.
Indexed file allocation
they have an additional block, and that block is known as the index block.
each file, there is an individual index block, which is an array of disk-block addresses.
the i-th entry in the index block points to the i-th block of the file.
the directory contains the address of the index block
to find and read the i-th block, we use the pointer in the i-th index-block entry.
Benefits
This scheme supports random access of the file.
This scheme provides fast access to the file blocks.
This scheme is free from the problem of external fragmentation.
Weaknesses
The pointer head is relatively greater than the linked allocation of the file.
Indexed allocation suffers from the wasted space.
For the large size file, it is very difficult for single index block to hold all the pointers.
For very small files say files that expend only 2-3 blocks the indexed allocation would keep on the entire block for the pointers which is insufficient in terms of memory utilization.
Contiguous file allocation
requires that
each file occupy a set of contiguous blocks on the disk
linear ordering on the disk is defined by the disk addresses
only one job is accessing the disk block b after that, it accesses the block b+1 and there are no head movements
when the movement of the head is needed the head moves only from one track to another track
disk number that is required for accessing the contiguous allocation is minimal.
Benefits
gives excellent read performance.
easy to implement.
supports both types of file access methods that are sequential access and direct access.
this method is fast because, in this method number of seeks is less due to the contiguous allocation of file blocks.
Weaknesses
Contiguous allocation method suffers internal as well as external fragmentation.
In terms of memory utilization, this method is inefficient.
It is difficult to increase the file size because it depends on the availability of contiguous memory.
DESCRIBE THE TWO FREE SPACE MANAGEMENT TECHNIQUES (using bitmaps/ bit vector and linked lists) (athirah) :
the two free space management techniques
maintains a free-space list.
The free-space list records all free disk blocks
reuse the space from deleted files for new files.
To create a file, search the free-space list for the required amount of space and allocate that space to the new file.
When a file is deleted, its disk space is added to the free-space list.
Frequently, the free-space list is implemented as a
bit map or
bit vector.
Bit Vector
Each block is represented by 1 bit.
Using Bitmaps/ Bit Vector
Bit map requires extra space
Example:
block size = 212 bytes
disk size = 230 bytes (1 gigabyte)
n = 230/212 = 218 bits (or 32K bytes)
Easy to get contiguous files
link to example:block size = 212 bytesdisk size = 230 bytes (1 gigabyte)
)
Figure 1
If the block is free, the bit is 1; if the block is allocated, the bit is 0.
For example, consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 17, 18, 25,26, and 27 are free and the rest of the blocks are allocated.
The free-space bit map would be 001111001111110001100000011100000 ...
ADVANTAGE OF BIT VECTOR
simplicity and efficiency in finding the first free block or n consecutive free blocks on the disk.
DISADVANTAGE OF BIT VECTOR
inefficient unless the entire vector is kept in main memory (and is written to disk occasionally for recovery needs).
Linked List
keeping a pointer to the first free block in a special location on the disk and caching it in memory.
we must read each block, which requires substantial I/O time
Cannot get contiguous space easily
No waste of space
Advantages
Whenever a file is to be allocated a free block, the operating system can simply allocate the first block in free space list and move the head pointer to the next free block in the list.
Disadvantages
Searching the free space list will be very time consuming; each block will have to be read from the disk, which is read very slowly as compared to the main memory.
Not Efficient for faster access.
Protection of file
Reliability is generally provided by duplicate copies of files (backup)
File systems can be damaged
by hardware problem
by power surges or failures
head crashes
dirt
temperature extremes
vandalism
File may be deleted accidentally
File contents coud be lost because of bugs
ways of protection can be provide
small single-user system
Physically removing the floppy disk
locking them in desk drawer or file cabinet
The need to protect files is direct result of the ability tp access files
Type of operations that can be controlled
read
allows a users to open and read a file or directory
write
allows a user to open a file or directory,make changes and save those changes
execute
allow a user to run an executable file
append
Copy the file from one location to another
Delete
Allow a user to delete a file or directory
List
Sorting a arrange the content of file
Gibson
Jazrin
Protection Problem
The most common approach to protection problem is make access dependent on the identity of the user.
How
Associate each file and directory to an access-control list (ACL) specifying user names and the types of access allowed for each user.
Access Matrix
The access matrix model is the policy for user authentication, and has several implementations such as “Access Control Lists (ACLs)” and “capabilities”.
use to describe which users have access to what objects.
Four major part
A list of objects
A list of subjects
A function T which returns an object's type
The matrix itself, with the objects making the columns and the subjects making the rows
Several standard operations associated with it
Entry of a right into a specified cell
Removal of a right from a specified cell
Creation of a subject
Creation of an object
Removal of an subject
Removal of an object
Condensed version
In order to condense the length of the access-control list, three classifications of users are introduced
1.Owner
The user who created the file is the owner.
2.Group
A set of users who are sharing the file and need similar access is a group, or work group.
3.Universe
All other users in the system constitute the universe
Techniques used to prevent data loss
Physical Backup
Physical Backup is an operating system backup. It saves the database data files onto tape or some other storage media. This type of backup is often used to recover the database to the point of failure.
The data files, redo log files and control files are saved on a backup media such as a tape storage system. The backup is accomplished by using both Windows NT operating system utilities and Oracle database utilities.
Two different types of physical backups
Cold backup
Also called an offline backup is a database backup during which the database is offline and not accessible to update.
Hot backup
1.Also known as dynamic or online backup. A backup performed on data while the database is active.
Logical Backup
uses the IMPORT/EXPORT utilities to create the backup copy of the database. A logical backup will backup the contents of the database.
can be used to recover the database to the last backup.
Both methods (logical and physical) can be used to restore a database. But what happens if the disk that holds one of the tablespace data files is damaged. Restoring the data from an IMPORT/EXPORT does not allow you to correct the damaged data file problem. To recover the database we must first restore the tablespace's data files. For these types of situations the backup strategy to use is the physical backup.