Chapter 11
File Systems and Directories
2
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.
3
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.
4
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.
5
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 typeExample: MyProg.exe
Warning: file extension is only helper information, it does not guarantee the file contents are actually organized that way. You can lie!!
6
File Types
Why are file extensions helpful?
1. OS uses file extension to select display icon, which helps user identify type of data in the file.
2. double-click on icon launches associated application and opens the data file
7
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
8
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
9
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.
10
File Access
Figure 11.2 Sequential file access
11
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).
12
File Access
Figure 11.3 Direct file access
13
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.
14
File Protection
A file’s protection settings in the Unix operating system is divided into three categories Owner Group World
Page 356
15
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)
16
Directory Trees
Figure 11.4 A Windows directory tree
17
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.
18
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.
19
Path Names
Examples of absolute paths:
C:\Program Files\MS Office\WinWord.exe
C:\My Documents\letters\applications\vaTech.doc
C:\Windows\System\QuickTime
20
Path Names
Examples of relative paths:
Suppose the current working directory isC:\My Documents\letters
Then the following relative path names could be used:cancelMag.docapplications\calState.doc..\csc101\proj2.java..\..\WINDOWS\Drivers\E55IC.ICM