Professional Documents
Culture Documents
640.chapter 10.1
640.chapter 10.1
Chapter 10.1
File Concept
Access Methods
Chapter 10.2
Directory Structure
File-System Mounting
File Sharing
Protection
Program files –
Source programs
Object files
May not be directly executable
May be understandable by a ‘linker.’
Executable files
May be ready for loader to bring into memory.
Much of the data about programs and data files revolves simply as
how they are used!
Write –
“System call” supplies name of file and data to be written.
A pointer usually needs to be available to “point” to the place
where the next ‘item’ is to be written; pointer updated.
Read –
Another system call specifies file name, location in memory where
read data is to be placed, and, using a pointer, locates data to be
read.
Pointer needs to be updated to point to ‘next’ item to be read.
Pointer for read and write: called a ‘current file-position pointer.’
When a file is opened for a process, an entry in the open-file table for
that process points to the entry in the system-wide table.
The system-wide table also keeps track of who has the same file open,
should more than a single process be accessing the file.
Close() decreases this count. When open count reaches zero, this file’s
entry is removed form the system-wide table.
For a specific file, all blocks are usually of the same size,
with the number of ‘logical records’ as some subset of the
block size.
Called ‘blocking factor’ BF = 100 one hundred logical
records per physical record (block).
Discuss
Why do we read/write ‘blocks’ in lieu of logical records?
Discuss.
cp = current position
On some direct access types of files, sequential processing is permitted, but not all..
On file organizations that permit both sequential and random access, both
random queries for retrievals and sequential processing for other requirements
such as reports, etc. are permitted.
Indexed Sequential Files (ahead) support both random and sequential access.
Direct Access files normally only support random access. (more ahead)
Logical records are contained within a block and blocks are read and written.
So, when a block is read from disk, this is followed by a sequential read of the
logical records within the block to see if the specific desired record lies within the
block
Typically the index (above) has keys (primary keys) and block numbers are shown.
The highest key in a block is shown. So we are not certain that the desired logical
record is actually in the block until it is retrieved and searched for.
An indexed sequential file is sorted (ordered) on some index or primary key, like name
(above) or account number (key must be unique).
Then an index of primary keys and disk addresses (kept in memory when file is active)
is used to locate a logical record.
(Actually disk addresses point to a block where the desired logical record ‘may’ be .)
Multiple keys may be used to search the file for a desired record.
Example: The file must be ordered on a unique primary key, such as account
number.
But we may also retrieve on a unique or non-unique secondary key such as name
(non-unique) or phone number (unique).
Operating System Concepts 10.33 Silberschatz, Galvin and Gagne ©2005
Example of Index Organization and Random
Access
For very large files, we may have levels of indexes (coarse index and fine
index; or index sets, sequence sets, data sets (IBM)).
The indices are searched via a binary search; the retrieved block is
searched sequentially for the desired logical record..
Relative Files are another kind of direct access file that does not allow for sequential access.
Due to the way the records in the file are created, sequential access, though possible, makes
little sense. This is because we typically us a field within a logical record and – based on that
Field within the record, computationally determine (usually, ‘hash’) a relative record number
– an integer – that provides the ‘relative’ displacement of the logical record from the beginning
of the file.
In a Relative File, the key to an individual record is usually computed and is an integer, such
as 3, 25, 65, 234, etc. and not related to the order in which it is added to the file.’
Again, there are other direct access file types besides indexed sequential and relative files.
Operating System Concepts 10.35 Silberschatz, Galvin and Gagne ©2005
End of Chapter 10.1