Unformatted text preview:

File systems 1File Systems• Result of integration of storage resources under a single hierarchy• File– A collection of related information defined by its creator– The abstraction used by the kernel to represent and organize the system’s non-volatile storage resources, includinghard disks, floppy disks, CD-ROMs, and optical disks.• Storage capacity of a system restricted to size of available virtual memory– May not be enough for applications involving large data– Virtual memory∗ Volatile∗ May not be good for long term storage– Information need not be dependent upon process∗ /etc/passwd file may need to be modified by different processes• Essential requirements of long-term information storage– Store very large amount of information– Information must survive termination of processes (be persistent)– Multiple processes must be able to access information concurrently– Store information in files• File system – Part of the OS that deals with file management– Creating, destroying, organizing, reading, writing, modifying, moving, and controlling access to files– Management of resources used by files• Basic functions of a file system– Present a logical or abstract view of files to users by hiding physical details of I/O devices– Facilitate the sharing of physical I/O devices and optimize their use– Provide protection mechanisms for data being transferred or managed by I/O devicesFiles• Most visible aspect of an OS, beside the user interface itself• Mechanism to store and retrieve information from the disk• Represent programs (both source and object) and data• Data files– May be numeric, alphanumeric, alphabetic, or binary– May be free form or formatted rigidly• File structure at user level– Characterized by field, record, file, and database– FieldFile systems 2∗ Basic data element∗ Contains a single value such as name or date∗ May be fixed length or variable length∗ Variable length fields can be indicated by special demarcation fields– Record∗ Collection of related fields, treated as a unit by an application∗ Employee record∗ May be fixed length or variable length∗ Entire record may include a length field– File∗ Collection of similar records∗ Treated as a single entity by users and applications and may be referenced by a name∗ May be created and deleted∗ Used to provide access control restrictions; in sophisticated systems, these restrictions may be provided atrecord or field level– Database∗ Collection of related data∗ Explicit relationships among data elements/fields∗ May contain one or more files∗ May be managed by a database management system that could be independent of OS• File structure at lower level– Byte sequence or stream∗ Used in almost all modern systems, including Unix and MS-DOS∗ Meaning on the bytes is imposed by user programs∗ Provides maximum flexibility but minimal support∗ Advantage to users who want to define their own semantics on files– Record sequence∗ Each file of a fixed length record∗ Card readers and line printer based records∗ Used in CP/M with a 128-character record– Tree∗ Useful for searches∗ Used in some mainframes• File management system– Provides services to users and applications in the use of files∗ Meet the data management needs of the user∗ Guarantee that the data in the file are valid∗ Optimize performance from system point of view (overall throughput) and user point of view (response time)• File accessed by a name– In both Unix and Windows, the filename can be up to 255 characters while DOS limits the name to 8 characters witha 3 character extension (the 8.3 system)– Unix name can consist of any characters, except /– Windows filename (long filename) can be any character except \ / :*? " < > |File systems 3∗ Windows creates an 8.3 version of every long filename∗ The short filename is created by inserting ˜ followed by sequential numbers after the sixth character of thefilename, plus the original extension• Created by a process and continues to exist after the process has terminated• Information in the file defined by creator• Naming conventions– Set of a fixed number of characters (letters, digits, special characters)– Case sensitivity– File type should be known to OS∗ to avoid common problems like printing binary files∗ to automatically recompile a program if source modified (TOPS 20)∗ to allow a web browser to do something intelligent with the information contained in the file, such as renderingan image or play music– File extension in DOS and Windows∗ May cause problems if the semantics of extensions change over time∗ In the earlier PCs, .DOC was a human readable file but in the mid-1990s, it changed to the proprietary non-human readable MS Word format– Getting information about a file∗ The file(1) command∗ stat(2) system call· First test performed by file(1)· Returns a file’s metadata – information about file in the system· File’s owner, access permissions, modification time information, and size· File type stored as a part of file permissions – types are only those used by the kernel to distinguish betweenfiles– Magic number in Unix∗ Second test performed by file(1)∗ Identification number for the type of file∗ The file(1) command identifies the type of a file using, among other tests, a test for whether the file beginswith a certain magic number∗ Magic number is specified in the file /etc/magic using four fields1. Offset: A number specifying the offset, in bytes, into the file of data which is to be tested2. Type: Type of data to be tested – byte, short (2-byte), long (4-byte), or string3. Value: Expected value for file type4. Message: Message to be printed if comparison succeeds∗ Used by the C compiler to distinguish between source, object, and assembly file formats∗ Developing magic numbers· Start with first four letters of program name (e.g., list)· Convert them to hex: 0x6c607374· Add 0x80808080 to the number· The resulting magic number is: 0xECE0F3F4· High bit is set on each byte to make the byte non-ASCII and avoid confusion between ASCII and binaryfiles– MIME media typesFile systems 4∗ Multipurpose Internet Mail Extensions∗ First RFC published in 1996∗ Created to account for dynamically generated content by server-side scripts to be consumed by web browsers∗ Describes the contents of a data stream, using concepts


View Full Document

UMSL CS 4760 - File Systems

Documents in this Course
Load more
Download File Systems
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 Systems 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 Systems 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?