0% found this document useful (0 votes)
4 views19 pages

Operating System Lecture Three: DR Jamal Altuwaijari

ok

Uploaded by

Yusef Abusalem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views19 pages

Operating System Lecture Three: DR Jamal Altuwaijari

ok

Uploaded by

Yusef Abusalem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Operating system

Lecture three
Dr jamal altuwaijari
3 - Information Management
C/S can store information on several different types of physical media
such as:
a- Magnetic tape.
b. Disk or drum.
c. Optical disk.
Each of these media has its own characteristics and physical
organization.
The 0/S provides a uniform logical view of information storage.
3-1 The File System
The file system consists of three distinct parts:.
a. A collection of files, each storing related data.
B. A directory structure, which organizes and provides information
about all the files in the system.
c. A partitions which are used to separate physically or logically large
collections of directories
3-2 File Concept
A file is a named collection of related information that is recorded on
secondary storage.
- The data cannot be written to secondary storage unless they are
within a file.
- Commonly files represent programs (Both source and object forms)
and data. -
- All disk I/O is units of one block (physical record) and all blocks are the
same size
3-3 Files Attributes
In addition to file name, a file has certain other attributes which vary from'
one 0/S to another but typically consists of these:
Name, Type, location, Size, Protection, Time and Date, User identification

3-4 File Operations


A file is an abstract data type, the 0/S provides system calls to create, write,
read, reposition, delete, and truncate files, appending, renaming, and copying.
When a file is open there are several pieces of information associated with an
open file:
a. File pointer. The 0/S must track the last read/ write location as a cullern- file
—position pointer. This pointer is unique to each process operating on the file.
b. File open count. This counter tracks the number of opens and closes of each
file.
c. Disk location of the file. The information needed to locate the file on disk is
kept in memory to avoid having to read it from disk for each operation
3-5 File Types
A common technique for implementing file types is to include the type
as a part of the file name. The name is split into two party a name and
an extension usually separated by a period character. In this was the
user and the 0/S can tell from the name alone what the type of a file is,
see Table 3.1
3-6 File Structure.
The file types may be used to indicate the internal structure of the file. If the 0/S
support multiple file structures the resulting size of 0/S must be increased to
contain the code to support these file structure.
The locating an offset within a file can be complicated for the 0/S. All disk I/O is
performed in units of one block (physical record) and all blocks are the same size.
It is unlikely that the physical record size will exactly match the length of the
logical record logical records may even vary in length
Packing a number of logical records into physical record is a common Solution to
this problem. For example, the UNIX 0/S defines all files to be simply a stream of
bytes. Each byte is individually addressable by its offset form the beginning (or
end) of the file. in this ease the logical record is 1 byte.
The logical record size, physical block size, and packing technique determine how
many logical records are in each physical block. The packing can be done either
by the user's application program or by the 0/S_ In either case the file may be
considered to be a sequence of blocks. All the basic I/O functions operate in
terms of blocks
3-7 Access Methods
Files store information. When is used this information must be
accessed and read into computer memory. There are several ways that
the information in the file can be accessed:
3-7-1 Sequential
The simplest access method is sequential access information in the file
is processed in order, one record after the other. This mode of access is
by far the most common, for example, editors and compilers usually
access files in this fashion.
The bulk of the operations on a file are reads and writes. A read
operation reads the next portion of the file and automatically advance
a file pointer which tracks the 1/0 location. A write appends to the end
of the file and advance, to the new end of file.
3-7-1 Sequential
See figure 3.1, This method is based on a tape mode of a file and works
as well on sequential—access devices as it does on random—access
ones
3-7-2 Direct access
Another method is direct access (or relative access). A file is made up of fixed
length logical records that allow programs to read and write records rapidly in no
particular order. This method is based on a disk model of a file since disks allow
random access to any file block. A direct access allows arbitrary to be read or
.written. Thus we may read block 14 then read block 53 and then write block 7
The operations must be modified to include the block number as a parameter. Thus
.we have read n where n is the block number rather than read next and write next
The block number provided by the user to the 0/S is relative block number. A
relative block number is an index relative to the beginning of the file, see Table 3.2
3-7-3 Other access Methods
These methods can be built on top of a direct access method. They involve the
construction of an index for the file. The index like an index in the block of a book
contain pointer to the various blocks. To find an entry in the file we first search the
index and then use the pointer to access the file directly and to find the desired
entry, see figure 3.3 .
We first make a binary search on the master index which provides the block
number of the secondary index. This block is read in and again a binary search is
used to find the block containing the desired record. Finally this block is searched
sequentially. In this way any record can be located from its key by at most two
direct—access reads
8-3 Directory structure
Some file systems store thousands of files on hundreds of giga bytes of
disk. To manage all these data we need to organization them. This
:organization is usually done in two parts
a. The file system is broken into partitions (mini disks), each disk on a
system contains at least one partition some areas within one disk
defined in one partition, each treated a separate storage device, where
as other systems allow partitions to be larger than a disk to group disks
into one logical structure
b.Each partition contain information about files within it. This
information is kept in entries in a device directory or volume table of
contents. The device directory records information such as name,
location, size, and type for all files on that partition. See figure 34
shows the typical file—system organization
8-3 Directory structure

The directory can he viewed as a symbol table that translates file


names into their directory entries. The following operation that are to
performed on a directory: search 'Or a file, create a file, delete a file,
list a directory, rename a file, and transverse the file system. The most
common schemes for defining the logical structure of a directory are :
3-8-1 Single—level Directory
It is the simplest structure. All files contained in the same directory, see
figure 3.5

:Advantages
It is easy to support and understand

:Disadvantages
When the number of files increases or when there is more than user. Since
all files in the same directory they must have unique names
3-8-2 Two-level Directory
In the two level directory structure, each user has his own user file
.directory (UFD)
Each UFD a similar structure, but lists only the files of a single user, see
figure 3.0

When a user logs in the system's master file directory, (MFD) is search.
The MFD is indexed by user name or by account number, and each
.entry points to the UFD for that user
3-8-2 Two-level Directory
:Advantages
.It is solves the name—collision problem .1
.It fasts to locate certain file name .2
.We can use the same file name in two different UFD .3

:Disadvantages
It requires a complicate search procedure where we need to join the
.user name with file name
3.8.3 Tree -Structured Directories
The two—level directory is a two level tree we can extend this structure
.to a tree of arbitrary height. See figure 3.8
This generalization allows user to create their own sub—directories and -
to organize their file accordingly. The MS-DOS system for example is
structured as tree

The tree has a root directory. Every file in the system has a unique path -
name. A path name is the path from the root through all the
.subdirectories to a specified file

A directory (or subdirectory) contains a set of files or subdirectories. A -


directory is simply another file but it is treated in a special way. One bit in
each directory defines the entry as a file (0) or as a subdirectory (1)
3.8.3 Tree -Structured Directories
3-8-4 Acyclic—Graph Directories
This organization provide more than one user to share all file or
.subdirectory
A share file or subdirectory will exist in the file system in two (or more )
places at once, see figure 3.9

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy