DOC PREVIEW
UB CSE 421 - File Management

This preview shows page 1-2-17-18-19-35-36 out of 36 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

File ManagementIntroductionTopics for DiscussionFile AttributesSlide 5File Operations and structuresFile OperationsAn Example Program Using File System Calls (1/2)An Example Program Using File System Calls (2/2)File managementElements of File ManagementDirectories Single-Level Directory SystemsTwo-level Directory SystemsHierarchical Directory SystemsPath NamesDirectory OperationsFile System ImplementationImplementing Files (1)Implementing Files (2)Implementing Files (3)Implementing Files (4)Implementing Directories (1)Implementing Directories (2)Shared Files (1)Shared Files (2)Disk Space ManagementUnix File ManagementOperationsInodesInformation in an inodeFile addressDirectoriesThe UNIX V7 File System (1)The UNIX V7 File System (2)The UNIX V7 File System (3)Summary01/17/19 B.Ramamurthy 1File ManagementB. Ramamurthy01/17/19 B.Ramamurthy 2IntroductionFile system is the most visible aspect of an operating system. It provides the mechanism for on-line storage of and access to programs and data. It provides the persistent storage capability to a system.File systems consists of a collection of files, a directory structure, access methods, secondary storage management and partitions (which separate logical and physical collection of directories.)01/17/19 B.Ramamurthy 3Topics for DiscussionFile AttributesFile operations and structuresFile ManagementFile OrganizationFile DirectoriesDirectory StructureFile sharing01/17/19 B.Ramamurthy 4File AttributesName: Symbolic reference for identifying the file object.Type: Information that indicates the contents of the file.Location: This information is a pointer a device and to the location of the file on that device.Size : The current size of the file (in bytes, words, or blocks).Protection: Access control information (RWX)Time, date and user identification: This information may be kept for (1) creation, (2) last modification and (3) last use. Useful for protection, security and usage monitoring.01/17/19 B.Ramamurthy 5File AttributesPossible file attributes01/17/19 B.Ramamurthy 6File Operations and structuresA file is an abstract data type.Operations: open, close, create, destroy, copy, rename, list, read, write, update, insert item, delete item, size,...Open file table: Table containing information about open files. When a file operation is requested, an index into this table is used for locating the file. When a file is closed the entry is removed from the table.Current file pointer: Last read/write location is kept as a current-file-position pointer. Each process using the file has a unique pointer. Where is it kept?File open count: Number of opens done on a given file. To allow deletion from Open file table, once the count reaches 0.01/17/19 B.Ramamurthy 7File Operations1. Create2. Delete3. Open4. Close5. Read6. Write7. Append8. Seek9. Get attributes10.Set Attributes11.Rename01/17/19 B.Ramamurthy 8An Example Program Using File System Calls (1/2)01/17/19 B.Ramamurthy 9An Example Program Using File System Calls (2/2)01/17/19 B.Ramamurthy 10File managementUsers and application programs interact with file system by means of commands for performing operations on files.These commands are translated into specific file manipulation commands, after ensuring that the kind of access requested is allowed.User view may be that of records or few bytes, but the actual IO is done in blocks. Data conversion to block “packing” is done. Optimized where applicable.Now IO subsystems takes over by translating the file sub commands into IO subsystem (disk IO) commands.01/17/19 B.Ramamurthy 11Elements of File ManagementUser &PrgmCommandsDirMgt.FileStructureFileAPIRecordsBlocksOS DiskScheduling etc.File management01/17/19 B.Ramamurthy 12DirectoriesSingle-Level Directory SystemsA single level directory systemcontains 4 filesowned by 3 different people, A, B, and C01/17/19 B.Ramamurthy 13Two-level Directory SystemsLetters indicate owners of the directories and files01/17/19 B.Ramamurthy 14Hierarchical Directory SystemsA hierarchical directory system01/17/19 B.Ramamurthy 15A UNIX directory treePath Names01/17/19 B.Ramamurthy 16Directory Operations1. Create2. Delete3. Opendir4. Closedir5.Readdir6.Rename7.Link8.Unlink01/17/19 B.Ramamurthy 17File System ImplementationA possible file system layout01/17/19 B.Ramamurthy 18Implementing Files (1)(a) Contiguous allocation of disk space for 7 files(b) State of the disk after files D and E have been removed01/17/19 B.Ramamurthy 19Implementing Files (2)Storing a file as a linked list of disk blocks01/17/19 B.Ramamurthy 20Implementing Files (3)Linked list allocation using a file allocation table in RAM01/17/19 B.Ramamurthy 21Implementing Files (4)An example i-node01/17/19 B.Ramamurthy 22Implementing Directories (1)(a) A simple directoryfixed size entriesdisk addresses and attributes in directory entry(b) Directory in which each entry just refers to an i-node01/17/19 B.Ramamurthy 23Implementing Directories (2)Two ways of handling long file names in directory(a) In-line(b) In a heap01/17/19 B.Ramamurthy 24Shared Files (1)File system containing a shared file01/17/19 B.Ramamurthy 25Shared Files (2)(a) Situation prior to linking(b) After the link is created(c)After the original owner removes the file01/17/19 B.Ramamurthy 26Disk Space Management(a) Storing the free list on a linked list(b) A bit map01/17/19 B.Ramamurthy 27Unix File ManagementUnix kernel views all files as streams of bytes.Four types of files are distinguished:Ordinary : regular files with data from user, or an application.Directory : Contains list of file names + pointers to associated inodes.Special : Terminals and other peripherals are abstracted as files.Named : named pipes.01/17/19 B.Ramamurthy 28Operations pathname searching : lookupname creation : creat, mknod, link, symlink, mkdirname change/deletion: rename, remove, rmdirattribute manipulation: access, getattr, setattrobject interpretation: open, readir,readlink,mmap,closeprocess control : advlock,ioctl,selectobject management : lock, unlock,inactive,reclaim,abortop01/17/19 B.Ramamurthy 29InodesInode (information node) is a structure that contains the key information needed for managing a file.Several files names may be associated with an inode.But each file contains exactly one file.01/17/19 B.Ramamurthy 30Information in an inodeFile mode (access and execution permissions)Link count ( how many references)Owner IDGroup IDFile SizeFile Address : 39 bytes of address information as


View Full Document

UB CSE 421 - File Management

Documents in this Course
Security

Security

28 pages

Threads

Threads

24 pages

Security

Security

20 pages

Security

Security

52 pages

Security

Security

20 pages

Load more
Download File Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view File Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view File Management 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?