Chapter 6 - File Systems

friendshomeopathInternet και Εφαρμογές Web

4 Δεκ 2013 (πριν από 3 χρόνια και 4 μήνες)

72 εμφανίσεις

File Systems


Long
-
term Information Storage


Store large amounts of information


Information must survive the termination of the
process using it


Multiple processes must be able to access the
information concurrently.


Files are the units on external media that
provide us with a solution to these three
issues.

File System



Part of the OS that manages these
aspects of files


Structuring


Naming


Accessing


Using


Protecting


Implemented



Files (User’s POV)


Files are given a name upon creation


Naming convention differs by OS


DOS has a 8 character limitation for the name


Windows XP supports 255 character file names


Character set that is allowed for naming of files
also differs by OS


Some OS have case sensitive file names


file, FILE, File, FiLe, filE are all different in UNIX
but the same in MS
-
DOS


Files (User’s POV) cont.


File Extensions


In addition to the name most OSs have a
second part of the file name called the
extension


Extension usually indicates the type of file


However, the extension may can be
renamed and the program that uses that
file could care less about the extension… it
will still load/execute the file correctly

Common File Extensions and
Meanings

File Structure


Unstructured Sequence of Bytes


Most
Flexible


Meaning must be imposed by the user


UNIX and Windows uses this


Record Sequence


fixed length records
each with some internal structure
(antiquated system)

File Structure (cont.)


Tree of Records


Each record contains
a key field in a particular position. The
tree is sorted on the key field for rapid
searching.


Used in mainframes and commercial data
processing

File Types


Regular Files


contain user information


Directories


system files that maintain
structure of the file system


Character Special


Used to model
serial I/O devices


Block Special


model disks

Regular Files


Usually either ASCII or Binary


ASCII


contains text (stuff we can read)


Binary


have an internal structure known
to the program that reads them (we
cannot open these up and easily read
them)

Binary (Executable and Archive)

File Access


Sequential


bytes read from beginning
to end with no ability to skip.


Random


Bytes can be read out of
order


read operation


give position in a file to
start reading at.


seek operation


sets the current position

File Attributes

File Operations


Create


file created and some
attributes set


Delete


removes file


Open


a process must open a file
before it is used. Fetches attributes


Close


frees up space


Read


Usually from current position
and caller must provide buffer


File Operations (cont.)


Write


Usually written at the current
position


Append


add data to the end of file


Seek


specifies where to retrieve data.
Repositions file pointer (often used
before a read or write)


Get Attributes/Set Attributes


Rename

Directories


Used to keep track (organize) files in a
logical manner.


Files themselves

Single
-
Level Directories


One directory containing all files for all
users.


What are the problems?

A single level directory system

contains 4 files

owned by 3 different people, A, B, and
C

Two
-
Level Directory


What if we provided a directory for
each user to store their files.


What does this solve?


What is still desired?

Hierarchical Directory


Allows users to group their files in a
logical manner (tree of directories)

Path Names


Absolute


specifies from the root
directory the full path to the file


Relative


specifies file location from
the current directory location


Working directory is another name for
current directory

Path Names (cont.)


. (dot)


notion for current directory


.. (dot dot)


notion for parent directory
of the current directory


These notions can be used when
specifying a relative path

Paths (cont.)

Directory Operations (UNIX)


Create


empty directory created


Delete


Opendir


opens a directory so that it can be read


Closedir


Readdir


returns next entry in an open directory


Rename


Link


Allows files to appear in more than one
directory


Unlink


directory entry is removed