chapter 11 file systems and directories

20
Chapter 11 File Systems and Directories

Upload: phelan-owen

Post on 03-Jan-2016

32 views

Category:

Documents


0 download

DESCRIPTION

Chapter 11 File Systems and Directories. 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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 11 File Systems and Directories

Chapter 11

File Systems and Directories

Page 2: 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.

Page 3: Chapter 11 File Systems and Directories

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.

Page 4: Chapter 11 File Systems and Directories

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.

Page 5: Chapter 11 File Systems and Directories

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!!

Page 6: Chapter 11 File Systems and Directories

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

Page 7: Chapter 11 File Systems and Directories

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

Page 8: Chapter 11 File Systems and Directories

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

Page 9: Chapter 11 File Systems and Directories

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.

Page 10: Chapter 11 File Systems and Directories

10

File Access

Figure 11.2 Sequential file access

Page 11: Chapter 11 File Systems and Directories

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).

Page 12: Chapter 11 File Systems and Directories

12

File Access

Figure 11.3 Direct file access

Page 13: Chapter 11 File Systems and Directories

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.

Page 14: Chapter 11 File Systems and Directories

14

File Protection

A file’s protection settings in the Unix operating system is divided into three categories Owner Group World

Page 356

Page 15: Chapter 11 File Systems and Directories

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)

Page 16: Chapter 11 File Systems and Directories

16

Directory Trees

Figure 11.4 A Windows directory tree

Page 17: Chapter 11 File Systems and Directories

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.

Page 18: Chapter 11 File Systems and Directories

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.

Page 19: Chapter 11 File Systems and Directories

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

Page 20: Chapter 11 File Systems and Directories

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