200 likes | 225 Views
Learn about files, directories, file types, access methods, and protection mechanisms in operating systems. Understand paths, tree structures, and file operations for efficient data management.
E N D
File Systems (Chapter 11.1) • File: 1. A named collection of related data. 2. smallest amount of information that can be written to secondary storage. 3. sequence of bits, bytes, lines or records • File system: Operating System’s logical view of files it manages. Often organized into a hierarchy (tree). • Directory: A named group of files. Also called a folder.
Text and Binary Files • file: - contains a program or data - creator of a file decides how it is organized - all computer files are patterns of 0’s and 1’s • Text file: A file in which the bytes of data are organized as characters from the ASCII or Unicode character sets. • Binary file: A file that contains data in a specific format, requiring interpretation.
Text and Binary Files (qualifier) • The terms text file and binary file are somewhat misleading… • They seem to imply that the information in a text file is not stored as binary data. • Ultimately, all information on a computer is stored as binary digits. • These terms refer to how those bits are formatted: as chunks of 8 or 16 bits, interpreted as characters, or in some other special format.
File Types • file type: identifies the kind of information in a file, and, therefore, the organization of the file For example, a file may contain a program, an image, or an audio clip. • file extension: indicates the file type Example: MyProg.exe • Warning: file extension is only helper information, it does not guarantee the file contents are actually organized that way. You can lie!!
File Types Why are file extensions helpful? • OS uses file extension to select display icon, which helps user identify type of data in the file. • double-click on icon launches associated application and opens the data file
File Types • File names are often separated, usually by a period, into two parts: • Main name • File extension • The file extension indicates the type of the file. Figure 11.1 Some common file types and their extensions
File Operations • Must distinguish between operations on files as atomic units and processing data inside • Atomic operations: delete, open, close, rename, copy • Processing data: read data, write data, reposition file pointer, append data, truncate
File Access • Sequential access:Information in the file is processed in order, and read and write operations move the current file pointer as far as needed to read or write the data. The most common file access technique, and the simplest to implement. Note: this largely describes file access and data processing, pre 1965. Files were stored on magnetic tape and batch processed.
File Access Figure 11.2 Sequential file access
File Access • Direct access: Files are conceptually divided into numbered logical records and each logical record can be accessed directly by number. Note: Files are now stored on magnetic (hard disc) or optical discs (CD/DVD-ROM), or other direct access devices (Flash drive).
File Access Figure 11.3 Direct file access
File Protection • In multiuser systems, file protection is of primary importance. • We don’t want one user to be able to access another user’s files unless the access is specifically allowed. • A file protection mechanism determines who can use a file and for what general purpose.
File Protection • A file’s protection settings in the Unix operating system is divided into three categories • Owner • Group • World Page 356
Directory Trees (Chapter 11.2) • A directory of files can be contained within another directory. The directory containing another is usually called the parent directory, and the one inside is called a subdirectory. • Directory tree: file system is commonly organized into a hierarchy called a directory tree. Looks like an upside-down tree. (UNIX OS, 1974) • Root directory:where the file system starts (indicated by \ (Windows), or / (UNIX)
Directory Trees Figure 11.4 A Windows directory tree
Directory Trees • At any point in time, you can be thought of as working in a particular location (that is, in a particular subdirectory). • Working directory: The subdirectory in which you are working.
Path Names • Path: location of a file or subdirectory in a file system, consisting of the series of directories through which you must go to find the file or subdirectory. • Absolute path: begins at the root directory • Relative path: begins at the current or working directory.
Path Names • Examples of absolute paths: C:\Program Files\MS Office\WinWord.exe C:\My Documents\letters\applications\vaTech.doc C:\Windows\System\QuickTime
Path Names • Examples of relative paths: • Suppose the current working directory is C:\My Documents\letters • Then the following relative path names could be used: cancelMag.doc applications\calState.doc ..\csc101\proj2.java ..\..\WINDOWS\Drivers\E55IC.ICM