SlideShare a Scribd company logo
Introduction
to
Operating Systems - 4
PROF. DR. K. ADISESHA
File management
File management File Concepts
Access methods
Allocation methods
Disk Management
Scheduling methods
2
File management
Introduction
Prof. Dr. K. Adisesha
3
Introduction to File:
A file is a named collection of related information that is recorded on secondary
storage such as magnetic disks, magnetic tapes and optical disks.
➢ File is a collection of logically related entities
❖ A file has a certain defined structure according to its type.
❖ A text file is a sequence of characters organized into lines.
❖ A source file is a sequence of procedures and functions.
❖ An object file is a sequence of bytes organized into blocks that are understandable
by the machine.
➢ When operating system defines different file structures, it also contains the code to
support these file structure. Unix, MS-DOS support minimum number of file structure
Introduction
Prof. Dr. K. Adisesha
4
File Type:
File type refers to the ability of the operating system to distinguish different types of file
such as text files source files and binary files etc.
➢ Operating system like MS-DOS and UNIX have the following types of files.
➢ Ordinary files
❖ These are the files that contain user information.
❖ These may have text, databases or executable program.
➢ Directory files
❖ These files contain list of file names and other information related to these files.
➢ Special files
❖ These files are also known as device files.
❖ These files represent physical device like disks, terminals, printers, networks, tape drive etc.
Introduction
Prof. Dr. K. Adisesha
5
File Attributes:
file is a collection of logically related entities.
➢ Name – only information kept in human-readable form
➢ Identifier – unique tag (number) identifies file within file system
➢ Type – needed for systems that support different types
➢ Location – pointer to file location on device
➢ Size – current file size
➢ Protection – controls who can do reading, writing, executing
➢ Time, date, and user identification – data for protection, security, and usage
monitoring Information about files are kept in the directory structure, which is
maintained on the disk.
File Operation
Prof. Dr. K. Adisesha
6
Operation on a File:
The file contains information about the files name, including attributes, location and
ownership.
➢ Operation performed on file are.
❖ Create a file
❖ Delete a file
❖ Open a file
❖ Close a file
❖ Write – at write pointer location
❖ Read – at read pointer location
❖ Reposition within file - seek
❖ Truncate the file system
File Access Methods
Prof. Dr. K. Adisesha
7
File Structure:
There are several types of files structures depending on its size and allocation.
➢ None - sequence of words, bytes
➢ Simple record structure
❖ Lines
❖ Fixed length
❖ Variable length
➢ Complex Structures
❖ Formatted document
❖ Relocatable load file
File Access Methods
Prof. Dr. K. Adisesha
8
File Access Mechanisms:
There are several ways to access files.
➢ Operating system like MS-DOS and UNIX have the following types of files.
❖ Sequential access
❖ Direct/Random access
❖ Indexed sequential access.
File Access Methods
Prof. Dr. K. Adisesha
9
Sequential access:
A sequential access is that in which the data in the file are accessed in a sequential
order in which there are stored.
➢ A sequential access is that in which the records are accessed in some sequence, i.e., the
information in the file is processed in order, one record after the other.
➢ This access method is the most primitive one.
➢ Example: Compilers usually access files in this fashion.
File Access Methods
Prof. Dr. K. Adisesha
10
Direct/Random access:
Direct access is that in which the data in the file are accessed in a Random order in
which there are stored.
➢ Random access file organization provides, accessing the records directly.
➢ Each record has its own address on the file with by the help of which it can be directly
accessed for reading or writing.
➢ The records need not be in any sequence within the file and they need not be in
adjacent locations on the storage medium.
File Access Methods
Prof. Dr. K. Adisesha
11
Indexed sequential access:
Indexed sequential access is that in which the data in the file are accessed using
pointers to search sequentially in which there are stored.
➢ This mechanism is built up on base of sequential access.
➢ An index is created for each file which contains pointers to various blocks.
➢ Index is searched sequentially and its pointer is used to access the file directly.
File Allocation
Prof. Dr. K. Adisesha
12
File Space Allocation:
Directories need to be fast to search, insert, and delete, with a minimum of wasted disk
space.
➢ Files are allocated disk spaces by operating system..
❖ Contiguous Allocation
❖ Linked Allocation
❖ Indexed Allocation
File Allocation
Prof. Dr. K. Adisesha
13
Contiguous Allocation:
In Contiguous file allocation, files are allocated disk spaces by operating system:
➢ Each file occupies 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
File Allocation
Prof. Dr. K. Adisesha
14
Linked Allocation:
In Linked file allocation, files are allocated disk spaces by operating system:
➢ Each file carries a list of links to disk blocks.
➢ Directory contains link / pointer to first block of a file.
➢ No external fragmentation
➢ Effectively used in sequential access file.
➢ Inefficient in case of direct access file.
File Allocation
Prof. Dr. K. Adisesha
15
Indexed Allocation:
In Indexed file allocation, files are allocated disk spaces by operating system:
➢ 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.
Space Management
Prof. Dr. K. Adisesha
16
Free-Space Management:
Important aspect of disk management is keeping track of and allocating free space:
➢ The optimal allocation method is different for sequential access files than for random
access files, and is also different for small files than for large files.
➢ Various methods for keeping track of and allocating free space are:
❖ Bit Vector
❖ Linked List
❖ Grouping
❖ Counting
❖ Space Maps
Assume the following are free. Rest are allocated:
Space Management
Prof. Dr. K. Adisesha
17
Free-Space Management:
Bit Vector:
➢ One simple approach is to use a bit vector, in which each bit represents a disk block,
set to 1 if free or 0 if allocated.
➢ Fast algorithms exist for quickly finding contiguous blocks of a given size
➢ The down side is that a 40GB disk requires over 5MB just to store the bitmap. ( For
➢ example. )
0- if disk block is allocated
1- if disk block is free
0 0 0 1 0 1 1 0 ----- 1
Space Management
Prof. Dr. K. Adisesha
18
Free-Space Management:
Linked List:
➢ A linked list can also be used to keep track of all free blocks.
➢ Traversing the list and/or finding a contiguous block of a given size are
tracked by the system just by adding and removing single blocks from
the beginning of the list.
➢ The FAT table keeps track of the free list as just one more linked list on
the table
Space Management
Prof. Dr. K. Adisesha
19
Free-Space Management:
Grouping:
➢ A variation on linked list free lists is to use links of blocks of indices of free blocks.
➢ If a block holds up to N addresses, then the first block in the linked-list contains up to N-1
addresses of free blocks and a pointer to the next block of free addresses.
Counting:
➢ When there are multiple contiguous blocks of free space then the system can keep track of the
starting address of the group and the number of contiguous free blocks.
➢ As long as the average length of a contiguous group of free blocks is greater than two this offers a
savings in space needed for the free list.
File Directories
Prof. Dr. K. Adisesha
20
File Directories:
Collection of files is a file directory. The directory contains information about the files,
including attributes, location and ownership.
➢ Advantages of maintaining directories are:
❖ Efficiency: A file can be located more quickly.
❖ Naming: It becomes convenient for users as two users can have same name for
different files or may have different name for same file.
❖ Grouping: Logical grouping of files can be done by properties e.g. all java
programs, all games etc.
File Directories
Prof. Dr. K. Adisesha
21
File Directories:
Collection of files is a file directory. The directory contains information about the files,
including attributes, location and ownership.
➢ file is a collection of logically related entities.
❖ Name
❖ Type
❖ Address
❖ Current length
❖ Maximum length
❖ Date last accessed
❖ Date last updated
❖ Owner id
❖ Protection information
File Directories
Prof. Dr. K. Adisesha
22
File Directories Types:
Collection of files is a file directory. The directory contains information about the files,
including attributes, location and ownership.
➢ Various types of directories are:
❖ Single-level Directory.
❖ Two-level Directory.
❖ Tree-structured Directory.
❖ Graph Directory.
File Directories
Prof. Dr. K. Adisesha
23
Single-level Directory:
In this a single directory is maintained for all the users.
➢ Naming problem: Users cannot have same name for two files.
➢ Grouping problem: Users cannot group files according to their need:
File Directories
Prof. Dr. K. Adisesha
24
Two-level Directory:
In this separate directories for each user is maintained.
➢ Path name: Due to two levels there is a path name for every file to locate that file.
➢ Now, we can have same file name for different user.
➢ Searching is efficient in this method.
➢ No grouping capability
File Directories
Prof. Dr. K. Adisesha
25
Tree-structured Directory:
Directory is maintained in the form of a tree.
➢ Searching is efficient and also there is grouping capability. We have absolute or
relative path name for a file.
File Directories
Prof. Dr. K. Adisesha
26
Graph Directory:
Directory is maintained in the form of a graph.
➢ Searching is efficient and also there is grouping capability.
➢ Allow only links to file not subdirectories
➢ Every time a new link is added use a cycle detection algorithm to determine whether it
is OK
➢ Garbage collection
File Sharing
Prof. Dr. K. Adisesha
27
File Sharing:
Specify how multiple users are to access a shared file simultaneously.
➢ Sharing of files on multi-user systems is desirable
➢ Sharing may be done through a protection scheme
➢ On distributed systems, files may be shared across a network
➢ Network File System (NFS) is a common distributed file-sharing method
➢ If multi-user system
❖ User IDs identify users, allowing permissions and protections to be per-user
Group IDs allow users to be in groups, permitting group access rights
❖ Owner of a file / directory
❖ Group of a file / directory
File Sharing
Prof. Dr. K. Adisesha
28
File Sharing – Remote File Systems:
Specify how multiple users on networking to allow file system access between systems..
➢ Manually via programs like FTP automatically, seamlessly using distributed file
systems
➢ Semi automatically via the world wide web
➢ Client-server model allows clients to mount remote file systems from servers
➢ Server can serve multiple clients
➢ Client and user-on-client identification is insecure or complicated
➢ Standard operating system file calls are translated into remote calls
➢ Distributed Information Systems such as LDAP, DNS, NIS, Active Directory
implement unified access to information needed for remote computing
File Protection
Prof. Dr. K. Adisesha
29
File Protection:
Specify how file owner/creator should be able to specify control the usage of files by
other users such as what can be done and by whom.
➢ Mode of access: read, write, execute
➢ Three classes of users on Unix / Linux
Storage management
Prof. Dr. K. Adisesha
30
Storage management:
Storage management deals with the storage procedures in the computer system using
an operating system.
➢ Disks are the mainly used mass storage devices. They provide the bulk of secondary
storage in operating systems today
➢ Various mass devices are:
❖ Magnetic Tapes
❖ Magnetic Disks
❖ Optical Disks
❖ Solid-State Disks
Storage management
Prof. Dr. K. Adisesha
31
Magnetic Tapes:
Magnetic tapes were once used for common secondary storage before the days of hard
disk drives, but today are used primarily for backups.
➢ Accessing a particular spot on a magnetic tape can be slow, but once reading or writing
commences, access speeds are comparable to disk drives.
➢ Capacities of tape drives can range from 20 to 200 GB, and compression can double
that capacity.
Storage management
Prof. Dr. K. Adisesha
32
Magnetic Disks:
One or more platters in the form of disks covered with magnetic media. Hard disk
platters are made of rigid metal, while "floppy" disks are made of more flexible plastic.
➢ Floppy disks and Hard drives are normally removable mass devices.
➢ Traditional magnetic disks have the following basic structure:
❖ Each platter has two working surfaces.
❖ Each working surface is divided into a number of concentric rings called tracks.
❖ Each track is further divided into sectors, traditionally containing 512 bytes of data
each.
❖ The data on a hard drive is read by read-write heads.
❖ The storage capacity of a traditional disk drive is equal to the number of heads.
Storage management
Prof. Dr. K. Adisesha
33
Magnetic Disks:
Traditional magnetic disks have the following basic structure.
➢ In operation the disk rotates at high speed, such as 7200 rpm ( 120 revolutions per
second. ).
❖ The seek time or random access time is the time required to
move the heads from one cylinder to another.
❖ The rotational latency is the amount of time required for the
desired sector to rotate around and come under the read-
write head.
❖ The transfer rate, which is the time required to move the
data electronically from the disk to the computer.
Storage management
Prof. Dr. K. Adisesha
34
Solid-State Disks (SSD):
SSDs use memory technology as a small fast hard disk. Specific implementations may
use either flash memory or DRAM chips protected by a battery to sustain the
information through power cycles.
➢ Because SSDs have no moving parts they are much faster than traditional hard drives,
and certain problems such as the scheduling of disk accesses simply do not apply.
➢ SSDs are especially useful as a high-speed cache of hard-disk information that must be
accessed quickly.
➢ They are more expensive than hard drives, generally not as large, and may have shorter
life spans.
➢ SSDs are also used in laptops to make them smaller, faster, and lighter.
Disk Scheduling
Prof. Dr. K. Adisesha
35
Disk Scheduling:
The operating system is responsible for using hardware efficiently - for the disk drives,
this means having a fast access time and disk bandwidth.
➢ Various Disk-Scheduling Algorithm are:
❖ FCFS Scheduling
❖ SSTF Scheduling
❖ SCAN Scheduling
❖ C-SCAN Scheduling
❖ LOOK Scheduling
Disk Scheduling
Prof. Dr. K. Adisesha
36
FCFS Scheduling:
First-Come First-Serve is simple and intrinsically fair, but not very efficient..
Disk Scheduling
Prof. Dr. K. Adisesha
37
SSTF Scheduling:
Shortest Seek Time First scheduling is more efficient, but may lead to starvation if a
constant stream of requests arrives for the same general area of the disk.
Disk Scheduling
Prof. Dr. K. Adisesha
38
SCAN Scheduling:
SCAN algorithm Sometimes called the elevator algorithm moves back and forth from
one end of the disk to the other, similarly to an elevator processing requests in a tall
building.
Disk Scheduling
Prof. Dr. K. Adisesha
39
C-SCAN Scheduling:
The Circular-SCAN algorithm improves upon SCAN by treating all requests in a
circular queue fashion .
➢ Once the head reaches the end of the disk, it returns to the other end without
processing any requests, and then starts again from the beginning of the disk.
Disk Scheduling
Prof. Dr. K. Adisesha
40
LOOK Scheduling:
LOOK scheduling improves upon SCAN by looking ahead at the queue of pending
requests, and not moving the heads any farther towards the end of the disk than is
necessary.
Discussion
Prof. Dr. K. Adisesha
41
Queries ?
Prof. K. Adisesha
9449081542

More Related Content

PPT
IV_UNIT.ppt
PPT
PPT
PDF
TFTP - Trivial File Transfer Protocol
PPTX
Concurrency control
PPTX
Unit 2 data link control
PPTX
Distributed Operating Systems
PDF
Xml databases
IV_UNIT.ppt
TFTP - Trivial File Transfer Protocol
Concurrency control
Unit 2 data link control
Distributed Operating Systems
Xml databases

What's hot (20)

PPT
15. Transactions in DBMS
PDF
Protocols and standards
PPT
Chapter 2 - Network Models
PPTX
Deadlock Prevention
PDF
Transport layer
PPTX
Raid and its levels
PPT
Transactions in dbms
PDF
Data comm and networking
PPT
4.file service architecture
PPTX
Transaction Processing in DBMS.pptx
PPTX
Computer networking devices
PPT
11. Storage and File Structure in DBMS
PPTX
Acid properties
PPTX
Dbms acid
PPT
Chapter 9 - Virtual Memory
PPT
Introduction to switching & circuit switching
PPTX
Client server architecture
PPTX
System components (os)
PPTX
RAID LEVELS
PPTX
Presentation on Transaction
15. Transactions in DBMS
Protocols and standards
Chapter 2 - Network Models
Deadlock Prevention
Transport layer
Raid and its levels
Transactions in dbms
Data comm and networking
4.file service architecture
Transaction Processing in DBMS.pptx
Computer networking devices
11. Storage and File Structure in DBMS
Acid properties
Dbms acid
Chapter 9 - Virtual Memory
Introduction to switching & circuit switching
Client server architecture
System components (os)
RAID LEVELS
Presentation on Transaction
Ad

Similar to Operating System-4 "File Management" by Adi.pdf (20)

PDF
Operating system 4 files by adi
PPTX
Operating System Unit 4(RTU Syllabus).pptx
PDF
oslectureset7.pdf
PPTX
Unit 6 OSY.pptx aaaaaaaaaaaaaaaaaaaaaaaa
PPTX
File Concept.pptx fa s fasfasfasfsfsfasfasfas
PPTX
Introduction to File System
PPTX
8 File Management system project .pptx
PPT
Unit 3 file management
PDF
Unit ivos - file systems
PDF
File system in operating system e learning
PPTX
OS Unit 4.pptx
PPT
network and system admistration by Chapter 4.ppt
PPT
Unit 3 chapter 1-file management
PDF
File Systems
PPTX
File concept and access method
PPTX
operating system notes for file managment.pptx
PPTX
File System operating system operating system
PPTX
file_concept.pptx file presentation directories
PPTX
Learn about the File Concept in operating systems ppt
PPTX
file_concept.pptx file presentation directories
Operating system 4 files by adi
Operating System Unit 4(RTU Syllabus).pptx
oslectureset7.pdf
Unit 6 OSY.pptx aaaaaaaaaaaaaaaaaaaaaaaa
File Concept.pptx fa s fasfasfasfsfsfasfasfas
Introduction to File System
8 File Management system project .pptx
Unit 3 file management
Unit ivos - file systems
File system in operating system e learning
OS Unit 4.pptx
network and system admistration by Chapter 4.ppt
Unit 3 chapter 1-file management
File Systems
File concept and access method
operating system notes for file managment.pptx
File System operating system operating system
file_concept.pptx file presentation directories
Learn about the File Concept in operating systems ppt
file_concept.pptx file presentation directories
Ad

More from Prof. Dr. K. Adisesha (20)

PDF
MACHINE LEARNING Notes by Dr. K. Adisesha
PDF
Probabilistic and Stochastic Models Unit-3-Adi.pdf
PDF
Genetic Algorithm in Machine Learning PPT by-Adi
PDF
Unsupervised Machine Learning PPT Adi.pdf
PDF
Supervised Machine Learning PPT by K. Adisesha
PDF
Introduction to Machine Learning PPT by K. Adisesha
PPSX
Design and Analysis of Algorithms ppt by K. Adi
PPSX
Data Structure using C by Dr. K Adisesha .ppsx
PDF
Operating System-3 "Memory Management" by Adi.pdf
PDF
Operating System Concepts Part-1 by_Adi.pdf
PDF
Operating System-2_Process Managementby_Adi.pdf
PDF
Software Engineering notes by K. Adisesha.pdf
PDF
Software Engineering-Unit 1 by Adisesha.pdf
PDF
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
PDF
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
PDF
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
PDF
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
PDF
Computer Networks Notes by -Dr. K. Adisesha
PDF
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
PDF
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
MACHINE LEARNING Notes by Dr. K. Adisesha
Probabilistic and Stochastic Models Unit-3-Adi.pdf
Genetic Algorithm in Machine Learning PPT by-Adi
Unsupervised Machine Learning PPT Adi.pdf
Supervised Machine Learning PPT by K. Adisesha
Introduction to Machine Learning PPT by K. Adisesha
Design and Analysis of Algorithms ppt by K. Adi
Data Structure using C by Dr. K Adisesha .ppsx
Operating System-3 "Memory Management" by Adi.pdf
Operating System Concepts Part-1 by_Adi.pdf
Operating System-2_Process Managementby_Adi.pdf
Software Engineering notes by K. Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Computer Networks Notes by -Dr. K. Adisesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha

Recently uploaded (20)

PDF
Business Ethics Teaching Materials for college
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Insiders guide to clinical Medicine.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
01-Introduction-to-Information-Management.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Pharma ospi slides which help in ospi learning
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Institutional Correction lecture only . . .
Business Ethics Teaching Materials for college
O7-L3 Supply Chain Operations - ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Insiders guide to clinical Medicine.pdf
VCE English Exam - Section C Student Revision Booklet
01-Introduction-to-Information-Management.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Anesthesia in Laparoscopic Surgery in India
Week 4 Term 3 Study Techniques revisited.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Pharma ospi slides which help in ospi learning
TR - Agricultural Crops Production NC III.pdf
Institutional Correction lecture only . . .

Operating System-4 "File Management" by Adi.pdf

  • 1. Introduction to Operating Systems - 4 PROF. DR. K. ADISESHA File management
  • 2. File management File Concepts Access methods Allocation methods Disk Management Scheduling methods 2 File management
  • 3. Introduction Prof. Dr. K. Adisesha 3 Introduction to File: A file is a named collection of related information that is recorded on secondary storage such as magnetic disks, magnetic tapes and optical disks. ➢ File is a collection of logically related entities ❖ A file has a certain defined structure according to its type. ❖ A text file is a sequence of characters organized into lines. ❖ A source file is a sequence of procedures and functions. ❖ An object file is a sequence of bytes organized into blocks that are understandable by the machine. ➢ When operating system defines different file structures, it also contains the code to support these file structure. Unix, MS-DOS support minimum number of file structure
  • 4. Introduction Prof. Dr. K. Adisesha 4 File Type: File type refers to the ability of the operating system to distinguish different types of file such as text files source files and binary files etc. ➢ Operating system like MS-DOS and UNIX have the following types of files. ➢ Ordinary files ❖ These are the files that contain user information. ❖ These may have text, databases or executable program. ➢ Directory files ❖ These files contain list of file names and other information related to these files. ➢ Special files ❖ These files are also known as device files. ❖ These files represent physical device like disks, terminals, printers, networks, tape drive etc.
  • 5. Introduction Prof. Dr. K. Adisesha 5 File Attributes: file is a collection of logically related entities. ➢ Name – only information kept in human-readable form ➢ Identifier – unique tag (number) identifies file within file system ➢ Type – needed for systems that support different types ➢ Location – pointer to file location on device ➢ Size – current file size ➢ Protection – controls who can do reading, writing, executing ➢ Time, date, and user identification – data for protection, security, and usage monitoring Information about files are kept in the directory structure, which is maintained on the disk.
  • 6. File Operation Prof. Dr. K. Adisesha 6 Operation on a File: The file contains information about the files name, including attributes, location and ownership. ➢ Operation performed on file are. ❖ Create a file ❖ Delete a file ❖ Open a file ❖ Close a file ❖ Write – at write pointer location ❖ Read – at read pointer location ❖ Reposition within file - seek ❖ Truncate the file system
  • 7. File Access Methods Prof. Dr. K. Adisesha 7 File Structure: There are several types of files structures depending on its size and allocation. ➢ None - sequence of words, bytes ➢ Simple record structure ❖ Lines ❖ Fixed length ❖ Variable length ➢ Complex Structures ❖ Formatted document ❖ Relocatable load file
  • 8. File Access Methods Prof. Dr. K. Adisesha 8 File Access Mechanisms: There are several ways to access files. ➢ Operating system like MS-DOS and UNIX have the following types of files. ❖ Sequential access ❖ Direct/Random access ❖ Indexed sequential access.
  • 9. File Access Methods Prof. Dr. K. Adisesha 9 Sequential access: A sequential access is that in which the data in the file are accessed in a sequential order in which there are stored. ➢ A sequential access is that in which the records are accessed in some sequence, i.e., the information in the file is processed in order, one record after the other. ➢ This access method is the most primitive one. ➢ Example: Compilers usually access files in this fashion.
  • 10. File Access Methods Prof. Dr. K. Adisesha 10 Direct/Random access: Direct access is that in which the data in the file are accessed in a Random order in which there are stored. ➢ Random access file organization provides, accessing the records directly. ➢ Each record has its own address on the file with by the help of which it can be directly accessed for reading or writing. ➢ The records need not be in any sequence within the file and they need not be in adjacent locations on the storage medium.
  • 11. File Access Methods Prof. Dr. K. Adisesha 11 Indexed sequential access: Indexed sequential access is that in which the data in the file are accessed using pointers to search sequentially in which there are stored. ➢ This mechanism is built up on base of sequential access. ➢ An index is created for each file which contains pointers to various blocks. ➢ Index is searched sequentially and its pointer is used to access the file directly.
  • 12. File Allocation Prof. Dr. K. Adisesha 12 File Space Allocation: Directories need to be fast to search, insert, and delete, with a minimum of wasted disk space. ➢ Files are allocated disk spaces by operating system.. ❖ Contiguous Allocation ❖ Linked Allocation ❖ Indexed Allocation
  • 13. File Allocation Prof. Dr. K. Adisesha 13 Contiguous Allocation: In Contiguous file allocation, files are allocated disk spaces by operating system: ➢ Each file occupies 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
  • 14. File Allocation Prof. Dr. K. Adisesha 14 Linked Allocation: In Linked file allocation, files are allocated disk spaces by operating system: ➢ Each file carries a list of links to disk blocks. ➢ Directory contains link / pointer to first block of a file. ➢ No external fragmentation ➢ Effectively used in sequential access file. ➢ Inefficient in case of direct access file.
  • 15. File Allocation Prof. Dr. K. Adisesha 15 Indexed Allocation: In Indexed file allocation, files are allocated disk spaces by operating system: ➢ 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.
  • 16. Space Management Prof. Dr. K. Adisesha 16 Free-Space Management: Important aspect of disk management is keeping track of and allocating free space: ➢ The optimal allocation method is different for sequential access files than for random access files, and is also different for small files than for large files. ➢ Various methods for keeping track of and allocating free space are: ❖ Bit Vector ❖ Linked List ❖ Grouping ❖ Counting ❖ Space Maps Assume the following are free. Rest are allocated:
  • 17. Space Management Prof. Dr. K. Adisesha 17 Free-Space Management: Bit Vector: ➢ One simple approach is to use a bit vector, in which each bit represents a disk block, set to 1 if free or 0 if allocated. ➢ Fast algorithms exist for quickly finding contiguous blocks of a given size ➢ The down side is that a 40GB disk requires over 5MB just to store the bitmap. ( For ➢ example. ) 0- if disk block is allocated 1- if disk block is free 0 0 0 1 0 1 1 0 ----- 1
  • 18. Space Management Prof. Dr. K. Adisesha 18 Free-Space Management: Linked List: ➢ A linked list can also be used to keep track of all free blocks. ➢ Traversing the list and/or finding a contiguous block of a given size are tracked by the system just by adding and removing single blocks from the beginning of the list. ➢ The FAT table keeps track of the free list as just one more linked list on the table
  • 19. Space Management Prof. Dr. K. Adisesha 19 Free-Space Management: Grouping: ➢ A variation on linked list free lists is to use links of blocks of indices of free blocks. ➢ If a block holds up to N addresses, then the first block in the linked-list contains up to N-1 addresses of free blocks and a pointer to the next block of free addresses. Counting: ➢ When there are multiple contiguous blocks of free space then the system can keep track of the starting address of the group and the number of contiguous free blocks. ➢ As long as the average length of a contiguous group of free blocks is greater than two this offers a savings in space needed for the free list.
  • 20. File Directories Prof. Dr. K. Adisesha 20 File Directories: Collection of files is a file directory. The directory contains information about the files, including attributes, location and ownership. ➢ Advantages of maintaining directories are: ❖ Efficiency: A file can be located more quickly. ❖ Naming: It becomes convenient for users as two users can have same name for different files or may have different name for same file. ❖ Grouping: Logical grouping of files can be done by properties e.g. all java programs, all games etc.
  • 21. File Directories Prof. Dr. K. Adisesha 21 File Directories: Collection of files is a file directory. The directory contains information about the files, including attributes, location and ownership. ➢ file is a collection of logically related entities. ❖ Name ❖ Type ❖ Address ❖ Current length ❖ Maximum length ❖ Date last accessed ❖ Date last updated ❖ Owner id ❖ Protection information
  • 22. File Directories Prof. Dr. K. Adisesha 22 File Directories Types: Collection of files is a file directory. The directory contains information about the files, including attributes, location and ownership. ➢ Various types of directories are: ❖ Single-level Directory. ❖ Two-level Directory. ❖ Tree-structured Directory. ❖ Graph Directory.
  • 23. File Directories Prof. Dr. K. Adisesha 23 Single-level Directory: In this a single directory is maintained for all the users. ➢ Naming problem: Users cannot have same name for two files. ➢ Grouping problem: Users cannot group files according to their need:
  • 24. File Directories Prof. Dr. K. Adisesha 24 Two-level Directory: In this separate directories for each user is maintained. ➢ Path name: Due to two levels there is a path name for every file to locate that file. ➢ Now, we can have same file name for different user. ➢ Searching is efficient in this method. ➢ No grouping capability
  • 25. File Directories Prof. Dr. K. Adisesha 25 Tree-structured Directory: Directory is maintained in the form of a tree. ➢ Searching is efficient and also there is grouping capability. We have absolute or relative path name for a file.
  • 26. File Directories Prof. Dr. K. Adisesha 26 Graph Directory: Directory is maintained in the form of a graph. ➢ Searching is efficient and also there is grouping capability. ➢ Allow only links to file not subdirectories ➢ Every time a new link is added use a cycle detection algorithm to determine whether it is OK ➢ Garbage collection
  • 27. File Sharing Prof. Dr. K. Adisesha 27 File Sharing: Specify how multiple users are to access a shared file simultaneously. ➢ Sharing of files on multi-user systems is desirable ➢ Sharing may be done through a protection scheme ➢ On distributed systems, files may be shared across a network ➢ Network File System (NFS) is a common distributed file-sharing method ➢ If multi-user system ❖ User IDs identify users, allowing permissions and protections to be per-user Group IDs allow users to be in groups, permitting group access rights ❖ Owner of a file / directory ❖ Group of a file / directory
  • 28. File Sharing Prof. Dr. K. Adisesha 28 File Sharing – Remote File Systems: Specify how multiple users on networking to allow file system access between systems.. ➢ Manually via programs like FTP automatically, seamlessly using distributed file systems ➢ Semi automatically via the world wide web ➢ Client-server model allows clients to mount remote file systems from servers ➢ Server can serve multiple clients ➢ Client and user-on-client identification is insecure or complicated ➢ Standard operating system file calls are translated into remote calls ➢ Distributed Information Systems such as LDAP, DNS, NIS, Active Directory implement unified access to information needed for remote computing
  • 29. File Protection Prof. Dr. K. Adisesha 29 File Protection: Specify how file owner/creator should be able to specify control the usage of files by other users such as what can be done and by whom. ➢ Mode of access: read, write, execute ➢ Three classes of users on Unix / Linux
  • 30. Storage management Prof. Dr. K. Adisesha 30 Storage management: Storage management deals with the storage procedures in the computer system using an operating system. ➢ Disks are the mainly used mass storage devices. They provide the bulk of secondary storage in operating systems today ➢ Various mass devices are: ❖ Magnetic Tapes ❖ Magnetic Disks ❖ Optical Disks ❖ Solid-State Disks
  • 31. Storage management Prof. Dr. K. Adisesha 31 Magnetic Tapes: Magnetic tapes were once used for common secondary storage before the days of hard disk drives, but today are used primarily for backups. ➢ Accessing a particular spot on a magnetic tape can be slow, but once reading or writing commences, access speeds are comparable to disk drives. ➢ Capacities of tape drives can range from 20 to 200 GB, and compression can double that capacity.
  • 32. Storage management Prof. Dr. K. Adisesha 32 Magnetic Disks: One or more platters in the form of disks covered with magnetic media. Hard disk platters are made of rigid metal, while "floppy" disks are made of more flexible plastic. ➢ Floppy disks and Hard drives are normally removable mass devices. ➢ Traditional magnetic disks have the following basic structure: ❖ Each platter has two working surfaces. ❖ Each working surface is divided into a number of concentric rings called tracks. ❖ Each track is further divided into sectors, traditionally containing 512 bytes of data each. ❖ The data on a hard drive is read by read-write heads. ❖ The storage capacity of a traditional disk drive is equal to the number of heads.
  • 33. Storage management Prof. Dr. K. Adisesha 33 Magnetic Disks: Traditional magnetic disks have the following basic structure. ➢ In operation the disk rotates at high speed, such as 7200 rpm ( 120 revolutions per second. ). ❖ The seek time or random access time is the time required to move the heads from one cylinder to another. ❖ The rotational latency is the amount of time required for the desired sector to rotate around and come under the read- write head. ❖ The transfer rate, which is the time required to move the data electronically from the disk to the computer.
  • 34. Storage management Prof. Dr. K. Adisesha 34 Solid-State Disks (SSD): SSDs use memory technology as a small fast hard disk. Specific implementations may use either flash memory or DRAM chips protected by a battery to sustain the information through power cycles. ➢ Because SSDs have no moving parts they are much faster than traditional hard drives, and certain problems such as the scheduling of disk accesses simply do not apply. ➢ SSDs are especially useful as a high-speed cache of hard-disk information that must be accessed quickly. ➢ They are more expensive than hard drives, generally not as large, and may have shorter life spans. ➢ SSDs are also used in laptops to make them smaller, faster, and lighter.
  • 35. Disk Scheduling Prof. Dr. K. Adisesha 35 Disk Scheduling: The operating system is responsible for using hardware efficiently - for the disk drives, this means having a fast access time and disk bandwidth. ➢ Various Disk-Scheduling Algorithm are: ❖ FCFS Scheduling ❖ SSTF Scheduling ❖ SCAN Scheduling ❖ C-SCAN Scheduling ❖ LOOK Scheduling
  • 36. Disk Scheduling Prof. Dr. K. Adisesha 36 FCFS Scheduling: First-Come First-Serve is simple and intrinsically fair, but not very efficient..
  • 37. Disk Scheduling Prof. Dr. K. Adisesha 37 SSTF Scheduling: Shortest Seek Time First scheduling is more efficient, but may lead to starvation if a constant stream of requests arrives for the same general area of the disk.
  • 38. Disk Scheduling Prof. Dr. K. Adisesha 38 SCAN Scheduling: SCAN algorithm Sometimes called the elevator algorithm moves back and forth from one end of the disk to the other, similarly to an elevator processing requests in a tall building.
  • 39. Disk Scheduling Prof. Dr. K. Adisesha 39 C-SCAN Scheduling: The Circular-SCAN algorithm improves upon SCAN by treating all requests in a circular queue fashion . ➢ Once the head reaches the end of the disk, it returns to the other end without processing any requests, and then starts again from the beginning of the disk.
  • 40. Disk Scheduling Prof. Dr. K. Adisesha 40 LOOK Scheduling: LOOK scheduling improves upon SCAN by looking ahead at the queue of pending requests, and not moving the heads any farther towards the end of the disk than is necessary.
  • 41. Discussion Prof. Dr. K. Adisesha 41 Queries ? Prof. K. Adisesha 9449081542