FILE MANAGEMENT - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

FILE MANAGEMENT

Description:

starting block and length of the file. Fragmentation will occur. Will become difficult to find contiguous blocks of sufficient length. Contiguous File Allocation ... – PowerPoint PPT presentation

Number of Views:74
Avg rating:3.0/5.0
Slides: 35
Provided by: debora71
Category:

less

Transcript and Presenter's Notes

Title: FILE MANAGEMENT


1
FILEMANAGEMENT
  • CS3450
  • Chapter 12

2
Figure 12.2Elements of File management
File structure
Physical Blocks in Main-memory Buffers
Physical Blocks in Secondary storage
Directory Management
Access Method
Records
Disk Scheduling
Blocking
User Program Commands
Operation, File name
Free Storage Management
I/O
File Manipulation functions
File Allocation
User Access Control
3
Files
  • Used for input to a program
  • Output of application saved in a file for
    long-term storage
  • A container for a collection of information

4
Terms Used with Files
  • Field
  • basic element of data
  • contains a single value
  • characterized by its length and data type
  • Record
  • collection of related fields
  • treated as a unit
  • Example employee record

5
Terms Used with Files
  • File
  • collection of similar records
  • treated as a single entity
  • have unique file names
  • may restrict access
  • Database
  • collection of related data
  • relationships exist among elements

6
What are files?
  • Collection of records
  • Fixed-length records
  • data files
  • Variable length records
  • text, programs

7
File Management System
  • The way a user of application may access files
  • Programmer does not need to develop file
    management software

8
Functions of File Management
  • Identify and locate a selected file
  • Use a directory to describe the location of all
    files plus their attributes
  • On a shared system describe user access control
  • Blocking for access to files
  • Allocate files to free blocks
  • Manage free storage for available blocks

9
Design Decisions
  • How should the files be structured?
  • How should files be stored?
  • How should files be accessed?

10
Design Considerations
  • Rapid access
  • needed when accessing a single record
  • not needed for batch mode
  • Ease of update
  • file on CD-ROM will not be updated, so this is
    not a concern

11
Design Considerations (cont.)
  • Economy of storage
  • should be minimum redundancy in the data
  • redundancy can be used to speed access such as an
    index
  • Simple maintenance
  • Reliability

12
File Directories
  • Contains information about files
  • attributes
  • location
  • ownership
  • Directory itself is a file owned by the operating
    system
  • Provides mapping between file names and the files
    themselves

13
Hierarchical, or Tree-Structured Directory
  • Most common directory structure
  • Files can be located by following a path from the
    root, or master, directory down various branches
  • this is the pathname for the file
  • Can have several files with the same file name as
    long as they have unique path names

14
File Structures
  • The OS must support at least the executable file.
    Applications can convert Byte Stream data into
    the correct format.
  • Byte stream (no format assumed)
  • Pile
  • Sequential
  • Indexed Sequential
  • Indexed File
  • Direct Or Hashed

15
File Access Methods
  • Sequential
  • Direct

16
File Sharing
  • Way to control access to a particular file
  • Users or groups of users are granted certain
    access rights to a file

17
Access Rights
  • None
  • user may not know of the existence of the file
  • user is not allowed to read the user directory
    that includes the file
  • Knowledge
  • user can only determine that the file exists and
    who its owner is

18
Access Rights
  • Execution
  • the user can load and execute a program but
    cannot copy it
  • Reading
  • the user can read the file for any purpose,
    including copying and execution
  • Appending
  • the user can add data to the file but cannot
    modify or delete any of the files contents

19
Access Rights
  • Updating
  • the user can modify, deleted, and add to the
    files data. This includes creating the file,
    rewriting it, and removing all or part of the
    data
  • Changing protection
  • user can change access rights granted to other
    users
  • Deletion
  • user can delete the file

20
Access Rights
  • Owners
  • has all rights previously listed
  • may grant rights to others using the following
    classes of users
  • specific user
  • user groups
  • all for public files

21
Simultaneous Access
  • User may lock entire file when it is to be
    updated
  • User may lock the individual records during the
    update
  • Mutual exclusion and deadlock are issues for
    shared access

22
Physical Storage Allocation (secondary storage)
  • Contiguous
  • Chained
  • Indexed

23
Methods of File Allocation
  • Contiguous allocation
  • single set of blocks is allocated to a file at
    the time of creation
  • only a single entry in the file allocation table
  • starting block and length of the file
  • Fragmentation will occur
  • Will become difficult to find contiguous blocks
    of sufficient length

24
Contiguous File Allocation
File Allocation Table
FileA
File Name
Start Block
Length
0
1
2
3
4
FileA
2
3
FileB
9
5
5
6
7
8
9
FileC
18
8
FileB
FileD
30
2
10
11
12
13
14
FileE
26
3
15
16
17
18
19
FileC
20
21
22
23
24
FileE
25
26
27
28
29
FileD
30
31
32
33
34
25
Methods of File Allocation
  • Chained allocation
  • allocation on basis of individual block
  • each block contains a pointer to the next block
    in the chain
  • only single entry in the file allocation table
  • starting block and length of file
  • No fragmentation
  • Any free block can be added to the chain
  • No accommodation of the principle of locality

26
Chained File Allocation
File Allocation Table
FileB
File Name
Start Block
Length
0
1
2
3
4
...
...
...
FileB
5
1
5
6
7
8
9
...
...
...
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
27
Methods of File Allocation
  • Indexed allocation
  • file allocation table contains a separate
    one-level index for each file
  • the index has one entry for each portion
    allocated to the file
  • the file allocation table contains block number
    for the index

28
Indexed Allocation with Block Portions
File Allocation Table
FileB
File Name
Index Block
0
1
2
3
4
...
...
5
6
7
8
9
FileB
24
...
...
10
11
12
13
14
15
16
17
18
19
1
8
20
21
22
23
24
3
14
25
26
27
28
29
28
30
31
32
33
34
29
Indexed Allocation - Var Length Portions
File Allocation Table
FileB
File Name
Index Block
0
1
2
3
4
...
...
5
6
7
8
9
FileB
24
...
...
10
11
12
13
14
15
16
17
18
19
Start Block
Length
20
21
22
23
24
1
3
28
4
14
1
25
26
27
28
29
30
31
32
33
34
30
Free Space management
  • Bit Tables
  • Chained Free Portions
  • Indexing

31
UNIX File Management
  • Files are streams of bytes
  • Types of files
  • ordinary - contents entered by user or program
  • directory - contains list of file names and
    pointers to inodes (index nodes)
  • special - used to access peripheral devices
  • named - named pipes

32
Windows NT File System
  • Sector - smallest unit of storage on a disk
  • Cluster - one or more contiguous sectors
  • Volume - logical partition on a disk

33
NTFS Volume Layout
partition boot sector
System Files
File Area
Master File Table
34
Windows NTFS Components
I/O Manager
Log the transaction
Read/write a mirrored or striped volume
Log File Service
NTFS Driver
Read/write the file
Fault Tolerant Driver
Flush the log file
Write the cache
Read/write the disk
Disk Driver
Load data from disk into memory
Cache Manager
Access the mapped file or flush the cache
Virtual Memory Manager
Write a Comment
User Comments (0)
About PowerShow.com