8 File Management system project .pptx

anitabricks49 25 views 45 slides Mar 07, 2025
Slide 1
Slide 1 of 45
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45

About This Presentation

file management


Slide Content

Ms. Jaya Gangwani Dept of CSE [email protected] 5CS4-03 Operating System File Management

Topics to be covered File Concept File Structure File Extensions File Attributes File Types File Operations Access Methods Allocation Methods File Protection Directory Structure

File Concept A file is a collection of correlated information which is recorded on secondary or non-volatile storage like magnetic disks, optical disks, and tapes. It is a method of data collection that is used as a medium for giving input and receiving output from that program. In general, a file is a sequence of bits, bytes, or records whose meaning is defined by the file creator and user. Every File has a logical location where they are located for storage and retrieval.

File Structure A File Structure needs to be predefined format in such a way that an operating system understands . It has an exclusively defined structure, which is based on its type. Three types of files structure in OS: A text file: It is a series of characters that is organized in lines. An object file: It is a series of bytes that is organized into blocks. A source file: It is a series of functions and processes.

File Extensions of different file types

File Attributes A file has a name and data. Moreover, it also stores meta information like file creation date and time, current size, last modified date, etc. All this information is called the attributes of a file system. Here, are some important File attributes used in OS: Name:  It is the only information stored in a human-readable form. Identifier : Every file is identified by a unique tag number within a file system known as an identifier. Location:  Points to file location on device.

File Attributes Type:  This attribute is required for systems that support various types of files. Size . Attribute used to display the current file size. Protection . This attribute assigns and controls the access rights of reading, writing, and executing the file. Time, date and security:  It is used for protection, security, and also used for monitoring

File Types It refers to the ability of the operating system to differentiate various types of files like text files, binary, and source files. However, Operating systems like MS_DOS and UNIX has the following type of files: Character Special File It is a hardware file that reads or writes data character by character, like mouse, printer, and more. Ordinary files These types of files stores user information. It may be text, executable programs, and databases. It allows the user to perform operations like add, delete, and modify.

File Types Directory Files Directory contains files and other related information about those files. Its basically a folder to hold and organize multiple files. Special Files These files are also called device files. It represents physical devices like printers, disks, networks, flash drive, etc.

File Operations The basic operations that can be performed on a file are: Create Write – at write pointer location Read – at read pointer location Reposition within file – seek Append Delete Open(F i ) – search the directory structure on disk for entry F i , and move the content of entry to memory Close (F i ) – move the content of entry F i in memory to directory structure on disk

File Access Methods File access is a process that determines the way that files are accessed and read into memory. Generally, a single access method is always supported by operating systems. Though there are some operating system which also supports multiple access methods. Three file access methods are: Sequential access Direct / Random access Index sequential access

Sequential Access In this type of file access method, records are accessed in a certain pre-defined sequence. In the sequential access method, information stored in the file is also processed one by one.

Sequential Access

Direct / Random Access The random access method is also called direct random access. This method allow accessing the record directly. Each record has its own address on which can be directly accessed for reading and writing. The technique used is Hashing. In hashing every record is associated with a key number to preprocess the address calculation. Hash function is used to obtain absolute address of a particular record.

Direct / Random Access

Index Sequential Access This type of accessing method is based on simple sequential access. In this access method, an index is built for every file, with a direct pointer to different memory blocks. In this method, the Index is searched sequentially, and its pointer can access the file directly. Multiple levels of indexing can be used to offer greater efficiency in access. It also reduces the time needed to access a single record.

Index Sequential Access

Example of Index and Relative File

File Allocation Methods In the Operating system, files are always allocated disk spaces. Three types of space allocation methods are: Contiguous Allocation Linked Allocation Indexed Allocation

Contiguous Allocation A single continuous set of blocks is allocated to a file at the time of file creation. Thus, this is a pre-allocation strategy, using variable size portions. The file allocation table needs just a single entry for each file, showing the starting block and the length of the file. This method is best from the point of view of the individual sequential file. Multiple blocks can be read in at a time to improve I/O performance for sequential processing. It is also easy to retrieve a single block. For example, if a file starts at block b, and the ith block of the file is wanted, its location on secondary storage is simply b+i-1.

Contiguous Allocation

Contiguous Allocation Disadvantage External fragmentation will occur, making it difficult to find contiguous blocks of space of sufficient length. Compaction algorithm will be necessary to free up additional space on disk. Also, with pre-allocation, it is necessary to declare the size of the file at the time of creation.

Linked Allocation Allocation is on an individual block basis. Each block contains a pointer to the next block in the chain. Again the file table needs just a single entry for each file, showing the starting block and the length of the file. Although pre-allocation is possible, it is more common simply to allocate blocks as needed. Any free block can be added to the chain. The blocks need not be continuous. Increase in file size is always possible if free disk block is available. There is no external fragmentation because only one block at a time is needed but there can be internal fragmentation but it exists only in the last disk block of file.

Linked Allocation

Linked Allocation Disadvantage: Internal fragmentation exists in last disk block of file. There is an overhead of maintaining the pointer in every disk block. If the pointer of any disk block is lost, the file will be truncated. It supports only the sequential access of files.

Indexed Allocation It addresses many of the problems of contiguous and chained allocation. In this case, the file allocation table contains a separate one-level index for each file: The index has one entry for each block allocated to the file. Allocation may be on the basis of fixed-size blocks or variable-sized blocks. Allocation by blocks eliminates external fragmentation, whereas allocation by variable-size blocks improves locality. This allocation technique supports both sequential and direct access to the file and thus is the most popular form of file allocation

Indexed Allocation

File Protection File systems often contain information that is highly valuable to their users. Protecting this information against unauthorized usage is therefore, a major concern of all the file systems.

File Protection File protection through Access Control Following are the few file operations that can be controlled: Read - Read a file Write - Write the file Append - Append a file Delete - Delete a file List - List the name and attributes of a file Rename - Rename a file Edit - Changing the contents of a file Copy - Make a copy of a file.

File Protection Access control list This list may contain the user name and the types of access allowed for each user. The operating system checks this access control list (associated with a file) whenever a user requests an access to a particular file. But one limitation of Access control list is their length, so we create groups.

File Protection Classify the users of a file into three types: 1. Owner - The user who created the file. 2. Group - A set of users who are sharing the file and need similar access. 3. Universe - All remaining users in the system constitute universe

File Protection File protection through password Files can be protected by a password. The owner of a file can control its access by assigning a password. Thus, only those users who know the password, can access a particular file.

File Directories Collection of files is a file directory. The directory contains information about the files, including attributes, location and ownership. Much of this information, especially that is concerned with storage, is managed by the operating system. The directory is itself a file, accessible by various file management routines.

File Directories Information contained in a device directory are: Name Type Address Current length Maximum length Date last accessed Date last updated Owner id Protection information

File Directories Operation performed on directory are: Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system

File Directories Advantages of maintaining directories are: Efficiency:  A file can be located more quickly. Naming:  It becomes convenient for users as two users can have same name for different files or may have different name for same file. Grouping:  Logical grouping of files can be done by properties e.g. all java programs, all games etc.

Directory Structures Different types of Directory Structures used are: Single-level Directory Two-level Directory Tree-level Directory Graph Structure Directory Acyclic Graph Directory General Graph Directory

Single-level Directory In this a single directory is maintained for all the users. Naming problem:  Users cannot have same name for two files. Grouping problem:  Users cannot group files according to their need.

Two-Level Directory In this separate directories for each user is maintained. Path name: Due to two levels there is a path name for every file to locate that file. Now, we can have same file name for different user. Searching is efficient in this method.

Access Paths Two possible methods for access path are: 1. Absolute path name: It is a listing of the directories and files from the root directory to the intended file. For example, the path ‘c:/windows/programs/spss.exe’ means that the root directory contains a subdirectory ‘windows’, which further contains a subdirectory ‘programs’, that contains an executable “spss.exe”. 2. Relative path name: This uses the concept of current directory (also known as working directory). A user can specify a particular directory as his current working directory and all the path names instead of being specified from the root directory are specified relative to the working directory. For example, if the current working directory is ‘\user\ curr ’, then the file whose absolute path is ‘\user\ curr \student’ can be referred simply as ‘student’.

Tree-level Directory Directory is maintained in the form of a tree. Searching is efficient and also there is grouping capability. We have absolute or relative path name for a file.

Acyclic Graph Directory

General Graph Directory Allow only links to file not subdirectories Garbage collection. Every time a new link is added use a cycle detection algorithm to determine whether it is OK

Questions asked in RTU Compare the methods by which we can access a file? Discuss the various directory structures. What are different operations performed on file? List the attributes of file. Explain: - i ) Two level directory ii) Tree structured directory iii) Acyclic graph directory iv) General graph directory .