Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3:File Management

Similar presentations


Presentation on theme: "Chapter 3:File Management"— Presentation transcript:

1 Chapter 3:File Management

2 Contents 3.1 Concept of the file. 3.2 File access techniques: a. sequential b. direct c. indexed 3.3 Directory structure: a. Storage structure b. Directory structure c. Single-level directory d. Two-level directory

3 cont.. 3.4 Methods of file allocation (benefits & weaknesses): a. Contiguous file allocation b. Linked file allocation c. Indexed file allocation 3.5 Free space management techniques: a. using bit maps / bit vector b. using linked list

4 cont.. 3.6 Types of operations: a. Read d. Append b. Write e. Delete c. Execute f. List 3.7 Access Control Matrix approach: a. Access control list b. Capability list 3.8 Techniques used to prevent data loss: a. Physical backup b. Logical backup.

5 Concept of the file. A file system organizes files and manages access to data. File systems are responsible for: File management – providing the mechanisms for files to be stored, referenced, shared and secured. Auxiliary (supporting) storage management – allocating space for files on secondary or tertiary storage devices. File integrity mechanisms – ensuring that the information stored in a file is uncorrupted. Access methods – how the stored data can be accessed.

6 Cont.. Files are mapped , by the operating system, onto physical devices. A file is a named collection of related information that is recorded on secondary storage. Data cannot be written to secondary storage unless they are within a file Files represent programs and data. Data files ,may be numeric, alphabetic, alphanumeric, or binary File is a sequence of bits , bytes, lines or records, the meaning of which is defined by the file’s creator n user.

7 File Organization technique
1. SEQUENTIAL. Entries in a sequential file are arranged in the way they were entered One whose records are arranged in an order place records in a block one after another until there is no room for another complete record in the block. accessed one record at a time, from first to last, in order. Each record can be of varying length. To reach a particular record, all the preceding records must be read. Example device: Magnetic Tapes Figure: Records are arranged in an order

8 File Organization technique
2. INDEX SEQUENTIAL contains records ordered by a record key The single-level indexing structure is the simplest one where a file, whose records are pairs, contains a key pointer. This pointer is the position in the data file of the record with the given key. A subset of the records, which are evenly spaced along the data file, is indexed, in order to mark intervals of data records. Example device : Disk storage

9 File Organization technique
3. DIRECT direct or hashed access a portion of disk space is reserved and a “hashing” algorithm computes the record address. So there is additional space required for this kind of file in the store. Records are placed randomly through out the file. Records are accessed by addresses that specify their disc location. without going through a lot of records to get to the one(s) you are after. Also, this type of file organization requires a disk storage rather than tape. Example: Disk

10 STORAGE STRUCTURE As computer system has multiple storage devices that can be partitioned to hold file systems and can be extended. For example, a Linux OS system as follows:

11 DIRECTORY STRUCTURE

12 DIRECTORY STRUCTURE The device directory (commonly known as a directory) records information such as name, location, size and type for all files on that information. Single-level directory- all files are contained in a single directory, which is support and understand. number of files increase or system has more than one user, its has significant limitation. single user on a single level directory difficult to remember the names of all the files as the number files increase. Leads to confusion of files names between different user.

13 DIRECTORY STRUCTURE Two-level directory
Each user has her own user file directory (UFD) Each UFD has a similar structure but lists is only the files of a single user. Master File directory – is indexed by user name or account number, and each entry point to the UFD for that user. Diadv. When the user want to cooperate on some task and to access one another’s files.- sometime system simply do not allow local user files to be access by other users

14 Methods of file allocation
As files are allocated and freed, it is common for the space on secondary storage to become increasingly fragmented. This can cause performance problems. Thus, we will discuss about the 3 methods of file allocation: Contiguous file allocation Linked file allocation Index file allocation

15 Contiguous File Allocation
File systems place data at contiguous address on storage device. The user specifies the amount of space needed to store the file in advance. If the desired amount of contiguous space is not available, the file CANNOT be created.

16 Contiguous file allocation
Contiguous allocation All bytes together, in order Random access Must know file size Fragmentation Pros: Simple: state required per file is start block and size Performance: entire file can be read with one seek Fastest if no changes are to be made also easiest for random access file. Cons: Fragmentation: external is bigger problem Usability: user needs to know size of file It is often difficult to find free space for a new file External fragmentation problem Poor performances as files grow and shrink over time. Used in CDROMs, DVDs

17 Linked file allocation
Each directory entry points to the first sector of a file on a moving-head storage device, ie: hard disk. 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. To read a file, simply read blocks by following the pointers from block to block.

18 Cont. Each block points to the next block Index with address to first
First word points to next block Can grow files dynamically Random Access is slow Internal Fragmentation Incomplete block sizes Unreliable: what if you lose one block in chain? Pros: simple=need only starting address, No waste of space, no external fragmentation Cons :size declaration problem.

19 Indexed file allocation
Each file has its own index block, which is an array of disk block addresses. The entry in the index block points to the block of the file. The directory contains the address of the index block. To read the block, we use the pointer in the index block entry to find and read the desired block.

20 An index block contains pointer to many other blocks
Associate each file with data structure: i-node table of file’s blocks Only need i-nodes in memory for open files set max # of open files Pros: no external fragmentation problem, solve the size declaration problem Cons: cannot support efficient direct access because the pointer to block are scattered anywhere.

21

22 Free space management techniques:
using bit maps / bit vector using linked list

23 Free space management Using Bit map

24 Free space management Using Link list

25 Types of Operation that can be controlled
Read – read from the file Write – write or re-write the file Execute – load the file into memory and execute it Append – Write new information at the end of the file Delete – delete the file and free its space for possible reuse List – list the name and attributes of the files

26 File Access Control Access Control Matrix
List all process and files in a matrix Each row is a process (“subject”) Each column is a file (“object”) Each matrix entry is the access rights that subject has for that object In an installation with a large number of users and a large number of files, this matrix generally would be large and sparse Inappropriate for most systems

27 Cont. TWO techniques for implementing file access control:
Access control list Capability list

28 Access Control list ( ACL)
Specifying the user name and the types of access allowed for each user. Three classification of user * Owner - user who created the file * Group – a set of users sharing the file and need similar access * Universe – all other users in the system User Request OS check Access list Allowed / denied

29 Capability List A capability is implemented as a data structure that contains: – Identifier: addresses or names. e.g. a segment of memory, an array, a file, a printer, or a message port. – Access right: read, write, execute, access, etc.   The capability concept was introduced by Dennis and Van Horn in 1966. ”A capability is a token, ticket, or key that gives the possessor permission to access an entity or object in a computer system”. Intuitive examples – A movie ticket is a capability to watch a movie. – A key is a capability to enter a house.

30 Example ( difference ):
Alice wishes to keep all of her valuables in three safe deposit boxes in the bank. Occasionally, she would like one or more trustworthy friends to make deposits or withdrawals for her. There are two ways that the bank can control access to the box. • The bank maintains a list of people authorized to access each box. • The bank issues Carla one or more keys to each of the safe deposit boxes.

31 Cont. A Capability List for a domain is a list of objects together with the operations allowed on those objects. (i.e.: Hydra system, Cambridge CAP system).

32 Capability List Approach
ACL Approach Capability List Approach – Authentication: The bank must authenticate. – Bank’s involvement: The bank must (i) store the list, (ii) verify users. – Forging access right: The bank must safeguard the list. – Add a new person: The owner must visit the bank. – Delegation: A friend cannot extend his or her privilege to someone else. – Revocation: If a friend becomes untrustworthy, the owner can remove his/her name. -Authentication: The bank does not need to authenticate. – Bank’s involvement: The bank need not be involved in any transactions – Forging access right: The key cannot be forged – Adding a new person: The owner can give the key to other people – Delegation: A friend can extend his or her privilege to someone else. – Revocation: The owner can ask for the key back, but it may not be possible to know whether or not the friend has made a copy.  

33 Techniques used to prevent data loss:
Physical backup Logical backup

34 Prevent Data Loss Physical backup
backups of the physical files used in storing and recovering your database, such as data files, control files, and archived redo logs is a copy of files storing database information to some other location, whether on disk or some offline storage such as tape.

35 Prevent Data Loss Logical backup
contain logical data (for example, tables or stored procedures) exported from a database with an Oracle export utility and stored in a binary file, for later re-importing into a database using the corresponding Oracle import utility. Physical backups are the foundation of any sound backup and recovery strategy. Logical backups are a useful supplement to physical backups in many circumstances but are not sufficient protection against data loss without physical backups.

36 END


Download ppt "Chapter 3:File Management"

Similar presentations


Ads by Google