# Operating System (CH 4)
# Operating System (CH 4)
By
Fikadu M.
[email protected]
Chapter
Four
File System
🠶 Directory Structure
🠶 Protection
🠶 Access
🠶 Space Allocation
🠶 Types:
🠶 Data files may be:
🠶 numeric
🠶 character
🠶 binary
🠶 Program
🠶 When the process terminates, the file continues to exist and can be accessed
by other processes using its name.
🠶 The exact rules for file naming vary somewhat from system to system, but all
current operating systems allow strings of one to eight letters as legal file
names.
🠶 Thus andrea, bruce, and cathy are possible file names. Frequently digits and
special characters are also permitted, so names like 2, urgent!, and Fig.2-14
are often valid as well.
🠶 Many file systems support names as long as 255 characters.
🠶 Thus a UNIX system can have all of the following as three distinct files:
maria, Maria, and MARIA. In MS-DOS, all these names refer to the
same file.
🠶 Many operating systems support two-part file names, with the two parts
separated by a period, as in prog.c.
🠶 The part following the period is called the file extension and usually
indicates something about the file.
🠶 In UNIX,
🠶 the size of the extension, if any, is up to the user, and a file may even have two or
more extensions, as in homepage.html.zip, where .html indicates a Web page in
HTML and .zip indicates that the file (homepage.html) has been compressed
using the zip program.
🠶 If an operating system recognize the type of file, it can then operate on the
file in reasonable ways.
🠶 They are vary from one operating system to another. The common attributes
are:-
🠶 Identifier – This unique tag, usually a number, identifies the file within the
file system; it is the non-human-readable name for the file.
🠶 Type – This information is needed for systems that support different types of
files.
🠶 Creating a file : A new file is defined and positioned within the structure of files.
🠶 Deleting a file : A file is removed from the file structure and destroyed. To delete a file, we
search the directory for the named file.
🠶 Opening a file : An existing file is declared to be "opened" by a process, allowing the
process to perform functions on the file.
🠶 Where begin and end are the beginning and ending positions of the
region being locked.
🠶 Files are stored on random-access storage devices, including hard disks, optical
disks, and solid state (memory-based) disks.
🠶 A storage device can be used in its entirety for a file system. It can also be
subdivided for finer-grained control.
🠶 For example, a disk can be partitioned into quarters, and each quarter can hold a
file system.
🠶 Partitioning is useful for limiting the sizes of individual file systems, putting multiple file-system
types on the same device, or leaving part of the device available for other uses, such as swap
space or unformatted (raw) disk space.
Directory
File
F F F
s F
1 2 4
3 F
n
🠶 Path name
🠶 Can have the same file name for different user
🠶 Efficient searching
🠶 No grouping capability
🠶 By whom
🠶 Systems that do not permit access to the files of other users do not need
protection.
🠶 Other operations, such as renaming, copying, and editing the file, may also
be controlled.
🠶 When a user requests access to a particular file, the operating system checks
the access list associated with that file. If that user is listed for the requested
access, the access is allowed. Otherwise, a protection violation occurs, and
the user job is denied access to the file.
🠶 Sequential access :the records are accessed in some sequence i.e. the
information in the file is processed in order, one record after the other.
Example: Compilers usually access files in this fashion.
🠶 Direct/Random access : Random access file
organization provides, accessing the records directly.
🠶The records need not be in any sequence within the file and they need not be
in adjacent locations on the storage medium.
🠶 Indexed sequential access : This mechanism is built up on base of
sequential access.
🠶 Index is searched sequentially and its pointer is used to access the file directly.
1. CONTIGUOUS ALLOCATION
🠶 Each file occupy a contiguous address space on disk.
🠶 Assigned disk address is in linear order.
🠶 Easy to implement.
🠶 External fragmentation is a major issue with this type of allocation technique.
3. INDEXED ALLOCATION
🠶 Provides solutions to problems of contiguous and linked allocation.
🠶 A index block is created having all pointers to files.
🠶 Each file has its own index block which stores the addresses of disk space occupied by the
file.
🠶 Directory contains the addresses of index blocks of files.