100% found this document useful (2 votes)
801 views

Chapter 8 - File Management

This document discusses file management in operating systems. It describes the responsibilities of the file manager, which include tracking file storage locations, implementing storage policies, allocating and deallocating files, and interacting with users through file access commands. Key concepts covered include file structures like records and fields, file organization techniques, and using directories and subdirectories to logically organize files on storage volumes.

Uploaded by

杨丽璇
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
801 views

Chapter 8 - File Management

This document discusses file management in operating systems. It describes the responsibilities of the file manager, which include tracking file storage locations, implementing storage policies, allocating and deallocating files, and interacting with users through file access commands. Key concepts covered include file structures like records and fields, file organization techniques, and using directories and subdirectories to logically organize files on storage volumes.

Uploaded by

杨丽璇
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 100

Understanding Operating Systems

Sixth Edition

Chapter 8
File Management
Learning Objectives

• The fundamentals of file management and the structure


of the file management system
• File-naming conventions, including the role of extensions
• The difference between fixed-length and variable-length
record format
• The advantages and disadvantages of contiguous,
noncontiguous, and indexed file storage techniques
• Comparisons of sequential and direct file access
• Access control techniques and how they compare
• The role of data compression in file storage

2
Table of Contents

• The File Manager


• Interacting with the File Manager
• File Organization
• Physical Storage Allocation
• Access Methods
• Level in a File Management System
• Access Control Verification Module
• Data Compression

3
The File Manager
• The File Manager controls every file in the system.
• The File Manager (File Management System) is the
software responsible for creating, deleting, modifying,
and controlling access to files, as well as for
managing the resources used by the files.
• These functions are performed in collaboration with
the Device Manager.

4
This PC – Windows 10

Nautilus - Ubuntu
5
Responsibilities of the File Manager
• Responsibilities - perform four tasks:
– File storage tracking
• Keep track of where each file is stored
– Policy implementation
• Determine where and how the files will be stored
• Efficiently use the available storage space;
• Provide efficient file access to the files.
– File allocation if user access is clear
• Allocate each file when a user has been cleared for access to
it, then record its use
– File deallocation
• Deallocate the file when the file is to be returned to storage
• Communicate the file availability to others who may be
waiting for it.

6
Responsibilities of the File Manager (cont’d)
• The File Manager keeps track of its files with directories
that contain:
– the filename;
– its physical location in secondary storage;
– Other important information about each file.

7
Responsibilities of the File Manager (cont’d)

• The File Manager’s policy determines:


– File storage location - where each file is stored
– How the system, and its users, will be able to access
them.
• Via device-independent commands.
• In addition, the policy must determine who will have
access to what material.
– This involves two factors:
• Flexibility of access to the information
• Its subsequent protection.

8
Responsibilities of the File Manager (cont’d)

• Factor 1: flexibility of access to information - the File


Manager does this by:
– Allowing access to shared files;
– Providing distributed access;
– Allowing users to browse through public directories.
• Factor 2: subsequent protection - the OS must:
– Protect its files against system malfunctions;
– Provide security checks via account numbers and
passwords to preserve the integrity of the data;
– Safeguard against tampering.

9
Responsibilities of the File Manager (cont’d)

• File allocation
– Activate secondary storage device, load file into
memory, and update records
• File deallocation
– Update file tables, rewrite file (if revised), and notify
waiting processes of file availability
• Any processes waiting to access the file are then
notified of its availability.

10
Important Definitions

Let’s take a minute to define some basic file elements, illustrated in Figure
8.1, that relate to our discussion of the File Manager.

11
Important Definitions (cont’d)

• Field
– A group of related bytes that can be identified by the
user with a name, type, and size.
• Record
– A group of related fields.
• File
– A group of related records that contains information to
be used by specific application programs to generate
reports.
– Flat file
• No connections to other files, no dimensionality

12
Important Definitions (cont’d)

• Database
– Groups of related files that are interconnected at
various levels to give users flexibility of access to the
stored data.
– If the user’s database requires a specific structure,
the File Manager must be able to support it.
• Program files
– Contain instructions;
– Data files contain data;
– As far as storage is concerned, the File Manager
treats them the same way.

13
Important Definitions (cont’d)

• Directories
– Special files with listings of filenames and their
attributes.
– Data collected to monitor system performance and
provide for system accounting is collected into files.
– Every program and data file accessed by the
computer system, and every piece of computer
software, is treated as a file.
– File Manager treats all files exactly same way as far
as storage is concerned

14
Interacting with the File Manager

• Users communicates with File Manager via specific


commands that may be either embedded in user’s
program or submitted interactively by user
• Embedded commands:
– OPEN & CLOSE pertain to availability of file for
program invoking it.
– READ & WRITE are I/O commands.
– MODIFY - specialized WRITE command for existing
data files that allows for appending/rewriting records.

15
Interacting with the File Manager

• Interactive Commands
– CREATE & DELETE - deal with system’s knowledge of
file.
– SAVE - first time used, a file is actually created.
– OPEN NEW - within a program indicates file must be
created.
– OPEN…FOR OUTPUT - creates file by making entry for it
in directory & finding space for it in secondary storage.
– RENAME - allows users to change name of existing file.
– COPY - allows user to make duplicate copies of existing
files.

16
Interacting with the File Manager

• Interface commands designed


to be as simple as possible to
use.
– Lack detailed instructions to
run device where file is
stored.
– Device independent.

17
Interacting with the File Manager (cont’d)

• To access a file, the user doesn’t need to know its


exact physical location on the disk pack or storage
medium
• Each logical command is broken down into a
sequence of lower-level signals that
– Trigger step-by-step actions performed by device.
– Supervise progress of operation by testing device’s
status.
• While all of this is going on, the system must check
for possible error conditions

18
Typical Volume Configuration

• Each storage unit (removable or not) is considered a


volume.
• Active files reside on secondary storage:
• Non-frequently used files can be stored offline and
mounted when the user specifically requests them.
• Each volume can contain several files called
– multifile volumes.
• Some files are extremely large and are contained in
several volumes called
– multivolume files.

19
Typical Volume Configuration (cont'd.)
• Each volume in the system is given a name.
• The File Manager writes this name and other
descriptive information on an easy-to-access place
on each unit.
– The innermost part of the CD or DVD;
– The beginning of the tape;
– The first sector of the outermost track of the disk pack

20
21
Typical Volume Configuration (cont'd.)
Master file directory (MFD) - Database
• MFD stored immediately after the volume descriptor
• Lists the names and characteristics of every file
contained in that volume.
– The filenames in the MFD can refer to:
• Program files
• Data files;
• System files;
– Subdirectories
• If the File Manager supports subdirectories.
– The remainder of the volume
• Used for file storage.
22
Typical Volume Configuration (cont'd.)
Master file directory (MFD) - Database
• Early OS supported only a single directory per
volume
– Created by File Manager
– Contains names of files
– Simple to implement and maintain
• Disadvantages
– Long search time for individual file
– Directory space filled before disk storage space filled
– Users cannot create subdirectories
– Users cannot safeguard their files
– Each program needs unique name
23
Introducing Subdirectories
• File Managers create an MFD for each volume that can
contain entries for both files and subdirectories.
• Subdirectory is created when a user opens an account
to access the computer system.
• Although the user directory is treated as a file, its entry in
the MFD is flagged to indicate to the File Manager that
this file is really a subdirectory and has unique
properties:
– Its records are filenames pointing to files.
• Still cant group files in a logical order to improve accessibility
and efficiency of system

24
Introducing Subdirectories (cont'd.)
• Today’s File Managers encourage users to create
subdirectories, so related files can be grouped together.
– Folders
• Tree structures allow the system to efficiently search
individual directories because there are fewer entries in
each directory.
– However, the path to the requested file may lead through
several directories.
• When the user wants to access a specific file:
– The filename is sent to the File Manager.
– The File Manager first searches the MFD for the user’s
directory.
– Then searches the user’s directory and any subdirectories
for the requested file and its location.
25
Introducing Subdirectories (cont'd.)

26
Introducing Subdirectories (cont'd.)
File Descriptor (view Details)
• Filename – Within a single directory, filenames must be
unique; in some OS, the filenames are case sensitive.
• File type – The organization and usage that are
dependent on the system (files and directories).
• File size – The size is kept here for convenience.
• File location – Identification of the first physical block (or
all blocks) where the file is stored.
• Date and time of creation
• Owner
• Protection information - Access restrictions.
• Record size – Its fixed size or its maximum size

27
File-Naming Conventions
• Two common components to many filenames are:
– Relative filename
– An extension

Relative Filename
• Can vary in length from 1 or more characters.
• Can include letters of alphabet & digits.
• Every OS has specific rules that affect length of
relative name & types of characters allowed.
– Eg: MS-DOS allows 1-8 alphanumeric character
names without spaces.
– More modern OS allow names with dozens of
characters including spaces.
28
File-Naming Conventions (cont'd.)
Extensions
• Some OS require an extension that’s appended to the
relative filename.
• Two to four characters and its purpose is to identify the
type of file or its contents.
– basia_tune.MP3
– take out menu.DOCX
• If an extension is incorrect or unknown, it requires user
intervention (Figure 8.5)
• Some extensions (.EXE, .BAT, .COB, .FOR) are
restricted by certain OS because they serve as a signal
to the system to use a specific compiler or program to
run these files. 29
File-Naming Conventions (cont'd.)

30
File-Naming Conventions (cont'd.)

(table 8.1)
File name parameters for several operating systems.

31
File Organization: Record Format

• Arrangement of records within files


• All files are composed of records.
• Modify command
– Request to access record within a file
• Within each file, the records are all presumed to
have the same format:
– Fixed length record
– Variable length record

32
Record Format
Fixed-length records - Easiest to access directly
• Most common type & ideal for data files.
• Record size critical (too small - truncation; too large -
wastes space)

Variable-length records - Difficult to access directly


because hard to calculate exactly where record is located.
• Don’t leave empty storage space & don’t truncate any
characters.
• Frequently used in files accessed sequentially (eg: text
files) or files using index to access records.
• File descriptor stores record format, how it’s blocked, &
other related info. 33
Record Format (cont'd.)

(figure 8.6)
Data stored in fixed length fields (top) that extends beyond the field limit is
truncated. Data stored in variable length fields (bottom) is not truncated.

34
Physical File Organization
• Describes the way records are arranged and the
characteristics of the medium used to store it.
• On magnetic disks (hard drives), files can be
organized by Sequential, Direct and Indexed
sequential
• File organization scheme selection considerations
– Volatility of data - frequency with which additions &
deletions made.
– Activity of file – percentage of records processed during
a given run.
– Size of file
– Response time - amount of time user is willing to wait
before requested operation is completed.
35
Physical File Organization (cont'd.)
Sequential record organization
• Records stored and retrieved serially
– One after the other
• Easiest to implement
• File search: beginning until record found
• Optimization features may be built into system
– Select key field from record and sort before storage
– Complicates maintenance algorithms
– Preserve original order when records added, deleted

36
Physical File Organization (cont'd.)
Direct record organization
• Uses direct access files which can be implemented
only on direct access storage devices.
• Give users flexibility of accessing any record in
any order without having to begin search from
beginning of file.
• Records are identified by their relative addresses
– Known as logical addresses
– Computed when records stored and retrieved
• Hashing algorithms
– Transform each key into a number
37
Physical File Organization (cont'd.)
Direct record organization (cont'd.)
• Advantages
– Fast record access
– Sequential access if starting at first relative address
and incrementing to next record
– Updated more quickly than sequential files
– No preservation of records order
– Adding, deleting records is quick
• Disadvantages
– Hashing algorithm collision: records with unique keys
may generate the same logical address
38
Physical File Organization (cont'd.)

39
Physical File Organization (cont'd.)
Direct Record Organization:
• Several records with unique keys may generate
same logical address (collision).
• Program generates another logical address before
presenting it to File Manager for storage.
• Colliding records stored in overflow area via links.
• File Manager handles physical allocation of space.
• Maximum file size established when created &
eventually file is full or too many records are stored
in overflow area.
• Programmer must reorganize & rewrite file.
40
41
Physical File Organization (cont'd.)
Indexed Sequential Record Organization
• Combines the best of sequential and direct access.
• Created and maintained through an Indexed Sequential
Access Method (ISAM) application.
• Doesn’t create collisions because it doesn’t use the
results of the hashing algorithm to generate a record’s
address.
– Uses info to generate index file through which records
retrieved.
• Divides ordered sequential file into blocks of equal size.
– Size determined by File Manager to take advantage

42
Physical File Organization (cont'd.)
Indexed Sequential Record Organization (cont’d)
• Each entry in index file contains highest record key &
physical location of data block where this record, &
records with smaller keys, are stored.
• To access any record in file, system begins by
searching index file & then goes to physical location
indicated at that entry.
• Overflow areas are spread throughout file
– Existing records can expand & new records are in close
physical & logical sequence.
– Last-resort overflow area is located apart from main data
area but is used only when the other overflow areas are
completely filled.
43
Physical File Organization (cont'd.)
Indexed Sequential Record Organization (cont’d)
• When retrieval time becomes too slow, file has to be
reorganized
– Usually performed b y maintenance software.
– For most dynamic files, indexed sequential is the
organization of choice because it allows both direct
access to a few requested records and sequential access
to many
• Allows both direct access to a few requested records &
sequential access to many records for most dynamic
files.
• A variation of indexed sequential files is B-tree.

44
Summary of Week 12

45
Physical Storage Allocation
• The File Manager must work with files not just as
whole units but also as logical units.
• Records within a file must have the same format but
they can vary in length.
• Records are subdivided into fields.
• Their structure is managed by application programs
and not the OS.
– An exception is made for those systems that are
heavily oriented to database applications, where the
File Manager handles field structure.
• When we talk about file storage, we are actually
referring to record storage.
• The File Mgr and the Device Mgr have to cooperate
to ensure successfully record storage and retrieval.
46
Physical Storage Allocation (cont'd.)

Understanding Operating Systems, Sixth Edition 47


Physical Storage Allocation
Contiguous Storage
• Records stored one after another.
• Used in early OS
– Advantages:
• Any record can be found and read once its starting
address, size are known (Streamlined Directory)
• Ease of direct access because every part of the file is
stored in the same compact area.

Understanding Operating Systems, Sixth Edition 48


Physical Storage Allocation
Contiguous Storage
– Disadvantages:
• A file can’t be expanded un less there’s empty space
available immediately following it (Figure 8.9).
– Room for expansion must be provided when the file is
created.
– If these’s not enough room, the entire file must be
recopied to a larger section of the disk every time
records are added.
• Fragmentation
– Can be overcome by compacting and rearranging files.
– Files can’t be accessed while compaction is taking
place.

Understanding Operating Systems, Sixth Edition 49


Physical Storage Allocation
Contiguous Storage
– The File Manager keeps track of the empty storage
areas by treating them as files.
• They’re entered in the directory but are flagged to
differentiate them from real files.
– Usually the directory is kept in order by sector
number, so adjacent empty areas can be combined
into one large free space.

Understanding Operating Systems, Sixth Edition 50


Physical Storage Allocation
Noncontiguous Storage
• Allows files to use any storage space available on
the disk.
• A File’s records are stored in a contiguous manner,
only if there’s enough empty space.
• Any remaining records and all other additions to the
file are stored in other sections of the disk.
– Extents of the file
• are linked together with pointers;
• The physical size of each extent is determined by the
OS:
• Usually 256 bytes
– Or another power of two – bytes.
Understanding Operating Systems, Sixth Edition 51
Physical Storage Allocation
Noncontiguous Storage
• File extents are usually linked in one of two ways:
– Storage Level
• Each extent points to the next one in the sequence
(Figure 8.10).
• The Directory entry consists of the:
– Filename
– Storage location of the first extent
– Location of the last extent
– Total number of extents (not counting first).

Understanding Operating Systems, Sixth Edition 52


Physical Storage Allocation
Noncontiguous Storage

Understanding Operating Systems, Sixth Edition 53


Physical Storage Allocation
Noncontiguous Storage
• File extents are usually linked in one of two ways
(cont’d):
– Directory Level
• Each extent is listed with its physical address, its size,
and a pointer to the next extent.
• A null pointer indicates that it’s the last one (Shown in
Figure 8.11 as a hyphen (-)).
• Although both noncontiguous allocation schemes
eliminate external storage fragmentation and the
need for compaction, they don’t support direct
access because there’s no easy way to determine
the exact location of a specific record.
Understanding Operating Systems, Sixth Edition 54
Physical Storage Allocation
Noncontiguous Storage

Understanding Operating Systems, Sixth Edition 55


Physical Storage Allocation
Noncontiguous Storage
• Files are usually declared to be either sequential or
direct when they’re created.
– so the File Manager can select the most efficient
method of storage allocation:
• Contiguous for direct files;
• Noncontiguous for sequential.
– OSs must have the capability to support both
storage allocation schemes.
– Eliminates external storage fragmentation
– Eliminates need for compaction

Understanding Operating Systems, Sixth Edition 56


Physical Storage Allocation
Noncontiguous Storage
• Files are usually declared to be either sequential or
direct when they’re created.
– Disadvantage
• No direct access support
– Cannot determine specific record’s exact location

Understanding Operating Systems, Sixth Edition 57


Physical Storage Allocation
Indexed Storage
• Allows direct record access by bringing together the
pointers linking every extent of that file into an index
block.
• Every file has its own index block, which consists of:
– The addresses of each disk sector that make up the
file.
• The index lists each entry in the same order in which
the sectors are linked (Figure 8.12).
– The third entry in the index block corresponds to the
third sector making up the file.

Understanding Operating Systems, Sixth Edition 58


Physical Storage Allocation
Indexed Storage

Understanding Operating Systems, Sixth Edition 59


Physical Storage Allocation
Indexed Storage
– When a file is created, the pointers in the index block
are all set to null.
– As each sector is filled, the pointer is set to the
appropriate sector address.
• The address is removed from the empty space list and
copied into its position in the index block.
• The scheme supports both sequential and direct
access.
– It doesn’t necessarily improve the use of storage
space because each file must have an index block
• Usually the size of one disk sector.

Understanding Operating Systems, Sixth Edition 60


Physical Storage Allocation
Indexed Storage
– For larger files with more entries, several levels of
indexes can be generated in which case, to find a
desired record:
• The File Manager accesses the first index;
– The highest level.
– Which points to a second index (lower level)
– Which points to an even lower-level index
– Which eventually points to the data record.

Understanding Operating Systems, Sixth Edition 61


Access Methods
• Dictated by a file’s organization.
– The most flexibility is allowed with indexed sequential
files;
– The least flexibility is with sequential files.
• A file that has been organized in sequential fashion
can support only sequential access to its records.
• These records can be of either fixed or variable length.
• The File Manager uses the address of the last byte
read to access the next sequential record.
– The Current byte address (CBA) must be updated
every time a record is accessed.
• Such as when a READ command is executed.
• Figure 8.13 shows the difference between storage
of fixed-length and of variable-length records.
Understanding Operating Systems, Sixth Edition 62
Access Methods (cont'd.)

Understanding Operating Systems, Sixth Edition 63


Access Methods
Sequential Access
• Sequential Access of Fixed-Length Records:
– The CBA is updated simply by incrementing it by the
record length (RL), which is constant.
• CBA = CBA + RL
• Sequential Access of Variable-length records:
– The File Manager adds the length of the record (RL)
plus the numbers of bytes used to hold the record
length (N, which holds the constant shown as m, n, p,
or q, in Figure 8.13) to the CBA,
• CBA = CBA + N + RL

Understanding Operating Systems, Sixth Edition 64


Access Methods
Direct Access
• If a file is organized in direct fashion, it can be
accessed in either direct or sequential order if the
records are of fixed length.
• In the case of direct access with fixed-length
records:
– The CBA can be computed directly from the record
length and the desired record number (information
provided through the READ command) minus 1.
• CBA = (RN – 1) * RL
– If we’re looking for the beginning of the eleventh record
and the fixed record length is 25 bytes, the CBA would
be:
» (11-1) * 25 = 250
Understanding Operating Systems, Sixth Edition 65
Access Methods
Direct Access
• If the file is organized for direct access with variable-
length records:
– It’s virtually impossible to access a record directly
because the address of the desired record cannot be
easily computed.
• To access a record:
– The File Manager must do a sequential search
through the records.
– It becomes a half-sequential read through the file
because the File Manager could save the address of
the last record accessed.

Understanding Operating Systems, Sixth Edition 66


Access Methods
Direct Access
• To access a record (cont’d):
– When the next request arrives, it could search
forward from the CBA if the address of the desired
record was between the CBA and the end of the file.
– Otherwise, the search would start from the beginning
of the file.
• An alternative is for the File Manager to keep a table
of record numbers and their CBAs.
– To fill a request:
• The table is searched for the exact storage location of
the desired record.

Understanding Operating Systems, Sixth Edition 67


Access Methods
Direct Access
• Records in an Indexed sequential file can be
accessed either sequentially or directly.
– Either of the procedures to compute the CBA
presented would apply with one extra step:
• The Index file must be searched for the pointer to the
block where the data is stored.
– Because the index file is smaller than the data file, it
can be kept in main memory, and a quick search can
be performed to locate the block where the desired
record is located.
– The block can then be retrieved from secondary
storage, and the beginning byte address of the record
can be calculated.
Understanding Operating Systems, Sixth Edition 68
Levels in a File Management System

• The efficient management of files can’t be separated


from the efficient management of the devices that
house them.
• The highest level module is called the “basic file
system”.
– It passes information through the access control
verification module to the logical file system.
• Which notifies the physical file system;
• Which works with the Device Manager.

Understanding Operating Systems, Sixth Edition 69


Levels in a File Management System

Understanding Operating Systems, Sixth Edition 70


Levels in a File Management System

• Each level of the file management system is


implemented using structured and modular
programming techniques that also set up a
hierarchy.
• The higher positioned modules pass information to the
lower modules.
• They, in turn, can perform the required service and
continue the communication down the chain to the
lowest module.
• Which communicates with the physical device and
interacts with the Device Manager.
• Only then is the record made available to the user.
Understanding Operating Systems, Sixth Edition 71
Levels in a File Management System

• Each of the modules can be further subdivided into


more specific tasks:

READ RECORD NUMBER 7 FROM FILE CLASSES INTO STUDENT

• CLASSES is the name of a direct access file


previously opened for input.
• STUDENT is a data record previously defined within
the program and occupying specific memory
locations.

Understanding Operating Systems, Sixth Edition 72


Levels in a File Management System

• Because the file has already been opened, the file


directory has already been searched to verify the
existence of CLASSES, and pertinent information
about the file has been brought into the OS’s active
file table.
• This information includes:
– Record Size;
– The address of its first physical record;
– Its protection;
– Access control information.

Understanding Operating Systems, Sixth Edition 73


Levels in a File Management System

• This information is used by the basic file system,


which activates the access control verification
module to verify that this user is permitted to
perform this operation with this file.
– If access is allowed, information and control are
passed along to the logical file system.
– If access is not allowed, a message saying “access
denied” is sent to the user.
• The logical file system transforms the record number
to its byte address:
CBA = (RN-1) * RL
Understanding Operating Systems, Sixth Edition 74
Levels in a File Management System

• This result, together with the address of the first


physical record and, in the case where records are
blocked, the physical block size, is passed down to
the physical file system, which computes the
location where the desired record physically resides.

byte address
Block number = integers [-----------------------] + address of the first physical record
• physical block size

byte address
offset = remainder [-----------------------]
physical block size

Understanding Operating Systems, Sixth Edition 75


Levels in a File Management System

• This information is passed on to the device interface


module which transforms the block number to the
actual cylinder/surface/record combination needed
to retrieve the information from the secondary
storage device.

Understanding Operating Systems, Sixth Edition 76


Levels in a File Management System

• Once retrieved, and, using the device-scheduling


algorithms, the information is placed in a buffer and
control returns to the physical file system, which
copies the information into the desired memory
location.
• When the operation is complete, the “all clear”
message is passed on to all other modules.

Understanding Operating Systems, Sixth Edition 77


Levels in a File Management System
• A WRITE command is handled in exactly the same
way until the process reaches the device handler.
• At that point, the portion of the device interface
module that handles allocation of free space, the
allocation module, is called into play because it’s
responsible for keeping track of unused areas in
each storage device.
• Verification, the process of making sure that a
request is valid, occurs at every level of the file
management system.

Understanding Operating Systems, Sixth Edition 78


Levels in a File Management System
• Verification process:
– The first verification occurs at the directory level when
the file system checks to see if the requested file
exists.
– The second occurs when the access control
verification module determines whether access is
allowed.
– The third occurs when the logical file system checks
to see if the requested byte address is within the file’s
limits.
– Finally, the device interface module checks to see
whether the storage device exists.
Understanding Operating Systems, Sixth Edition 79
Access Control Verification Module
• The first OS couldn’t support file sharing among
users.
– Early systems needed 10 copies of a compiler to
serve 10 users.
– Today’s systems require only a single copy to serve
everyone.
• Any file can be shared
– Data files, user-owned program files, system files.
• Advantages:
– It saves space;
– Allows for the synchronization of data updates.
• As when two application program are updating the
same data file.
Understanding Operating Systems, Sixth Edition 80
Access Control Verification Module
• Advantages (cont’d):
– It improves the efficiency of the system’s resources.
• If files are shared in main memory, then there’s a
reduction of I/O operations.
• Disadvantages:
• The integrity of each file must be safeguarded.
– Calls for control over who is allowed to access the file
– What type of access is permitted.
• Five possible actions that can be performed on a
file:
– READ only, WRITE only, EXECUTE only, DELETE
only;
– Some combination of the four.
Understanding Operating Systems, Sixth Edition 81
Access Control Verification Module
Access Control Matrix
• Easy to implement.
• Because of it size it only works well for systems with
a few files and a few users.
• In the matrix:
– Each column identifies a user and each row identifies
a file.
– The intersection of the row and column contains the
access rights for that user to that file.

Understanding Operating Systems, Sixth Edition 82


Access Control Verification Module
Access Control Matrix
• In The Matrix:
– Access rights identified by the letters RWED:
• R = Read
• W = Write
• E = Execute Address
• D = Delete Access
• (-) = Access not allowed
• Table 8.2 illustrates.

Understanding Operating Systems, Sixth Edition 83


Access Control Verification Module
Access Control Matrix

Understanding Operating Systems, Sixth Edition 84


Access Control Verification Module
Access Control Matrix
• In the actual implementation, the letters, RWED are
represented by bits 1 and 0;
– 1 indicates that access is allowed;
– 0 indicates that access is denied.
• As the numbers of files and users increase, the
matrix becomes extremely large – sometimes too
large to store in main memory.
• A lot of space is wasted because many of the
entries are all null.

Understanding Operating Systems, Sixth Edition 85


Access Control Verification Module
Access Control Matrix

Understanding Operating Systems, Sixth Edition 86


Access Control Verification Module
Access Control Lists

Understanding Operating Systems, Sixth Edition 87


Access Control Verification Module
Access Control Lists
• Some systems shorten the access control list even
more by putting every user into a category:
– SYSTEM or ADMIN
• System personnel who have unlimited access to all files
in the system.
– OWNER
• Has absolute control over all files created in the
owner’s account.
– GROUP
• All users belonging to the appropriate group have
access.
– WORLD
• All other users in system.
Understanding Operating Systems, Sixth Edition 88
Access Control Verification Module
Capability Lists
• Lists every user and the files each has access to.
• In OS such as LINUX or UNIX, they can control
access to devices as well as to files.
• The most commonly used is the access control list.

Understanding Operating Systems, Sixth Edition 89


Data Compression
• Data Compression algorithms consist of two types:
– Lossless algorithms typically used for text or
arithmetic files.
• Retains all the data in the file throughout the
compression-decompression process.
– Lossy algorithms typically used for image and sound
files.
• Remove data permanently.
– Unwanted noise
– Tones beyond a human’s ability to hear
– Light spectrum that we can’t see

Understanding Operating Systems, Sixth Edition 90


Data Compression
Text Compression
• Three methods to compress text in a database:
– Records with repeated characters;
– Repeated terms;
– Front-end compression.

Understanding Operating Systems, Sixth Edition 91


Data Compression
Text Compression
• Records with repeated characters:
– Data in a fixed-length field might include a short name
followed by many blank characters.
– This can be replaced with a variable-length field and a
special code to indicate how many blanks were
truncated.

ADAMSbbbbbbbbbb

Encoded looks like this:

ADAMSb10

Understanding Operating Systems, Sixth Edition 92


Data Compression
Text Compression
• Records with repeated characters:
– Likewise, numbers with many zeroes can be
shortened, with a code (#) to indicate how many
zeroes must be added to recreate the original
number.

300000000

Encoded looks like this:

3#8

Understanding Operating Systems, Sixth Edition 93


Data Compression
Text Compression
• Repeated terms:
– Compressed by using symbols to represent each of
the most commonly used words in the database.
– University student database common words:
• Student, course, grade, department could each be
represented with single character
– Of course, the system must be able to distinguish
between compressed and uncompressed data.

Understanding Operating Systems, Sixth Edition 94


Data Compression
Text Compression
• Front-end compression:
– Builds on the previous data element.
• The student database where the students’ names are
kept in alphabetical order could be compressed
(Table 8.6).
– Entry takes given number of characters from previous
entry that they have in common.
– Storage space is gained, but processing time is lost.
– The system must be able to distinguish between
compressed and uncompressed data.

Understanding Operating Systems, Sixth Edition 95


Data Compression
Other Compression Schemes
• Lossy compression allows a loss of data from the
original file to allow significant compression.
– The compression process is irreversible as the
original file cannot be reconstructed.
• The specifics of the compression algorithm are
highly dependent on the type of file being
compressed.
– JPEG – a popular option for still images
– MPEG – for video images

Understanding Operating Systems, Sixth Edition 96


Data Compression
Other Compression Schemes
• The International Organization for Standardization
(ISO) has issued MPEG standards that “are
international standards dealing with the
compression, decompression, processing, and
coded representation of moving pictures, audio, and
their combination.”
• ISO is the world’s leading developer of international
standards.

Understanding Operating Systems, Sixth Edition 97


Summary
• The File manager controls every file in the system
and processes the user’s commands:
– Read, write, modify, create, delete, etc.)
– To interact with any file on the system.
• It also manages the access control procedures to
maintain the integrity and security files under its
control.
• The File Manager must be able to accommodate a
variety of file organizations, physical storage,
allocation schemes, record types, and access
methods.

Understanding Operating Systems, Sixth Edition 98


Summary (cont’d)
• In this chapter we discussed:
– Sequential, direct, and indexed sequential file
organization;
– Contiguous, noncontiguous, and indexed file storage
allocation;
– Fixed-length versus variable-length records;
– Three methods of access control;
– Data compression techniques.

Understanding Operating Systems, Sixth Edition 99


Summary (cont’d)
• To get the most from a File Manager, it’s important
for users to realize:
– The strengths and weaknesses of its segments;
– Which access methods are allowed on which devices;
– With which record structures;
– The advantages and disadvantages of each in overall
efficiency.

Understanding Operating Systems, Sixth Edition 100

You might also like