Presentation is loading. Please wait.

Presentation is loading. Please wait.

DAT2343 File Storage and Access © Alan T. Pinck / Algonquin College; 2003.

Similar presentations

Presentation on theme: "DAT2343 File Storage and Access © Alan T. Pinck / Algonquin College; 2003."— Presentation transcript:

1 DAT2343 File Storage and Access © Alan T. Pinck / Algonquin College; 2003

2 Logical File Storage: Hierarchy Storage Hierarchy Drive Directory/Folder … File

3 Logical File Storage: File Structures Non-structured files: stream / byte files Structured files: fixed structure record files fields bytes structured sub-files separate header, data areas (e.g. object files) data bases

4 Logical File Storage: Access Methods Sequential stream or fixed structure records in general, re-write of a single record is not possible Direct Byte Offset Direct Record must be fixed structure records re-write of a single record common Database

5 Physical Disk Storage: Disk Structure

6 Physical Disk Storage: Track Sectors There are the same number of sectors on the (shorter) inside tracks as on the longer (outside) tracks. The amount of data stored depends upon the transfer rate and not the length of the area. However, this may mean that inside tracks are more prone to errors.

7 Physical Disk Storage: Physical Record/Sector Location Drive ID Cylinder Number how far to move the access arm in Surface Number with the cylinder number identifies a specific track Track-Sector Number established by FORMAT (sector ID & data area)

8 Physical Disk Storage: Disk Controller Commands Commands which must be sent to a disk controller to read/write a sector Drive select (Start Rotation) Arm Position Seek Sector ID Begin Transfer

9 Translation of Logical File IO To Physical Disk IO : Open File (for a file at the root) Root directory (at a fixed physical location) is read into memory Directory entries include file name and physical starting location If a match is found with the file to be opened, a pointer is saved to the beginning of the file space (for a file not at the root, each subdirectory from the root down to the directory containing the file must be read)

10 Translation of Logical File IO To Physical Disk IO : Read Record If the buffer area (the area containing a copy of the disk sector) is empty, commands are sent to the disk controller to read the sector at the disk pointer location and the disk pointer is updated to point at the next sector which is part of this file. An area equal in size to the logical record is copied from the buffer area to the logical record area and an internal buffer pointer is updated.

11 Translation of Logical File IO To Physical Disk IO : Next Sector Location of the next sector in a file can be achieved by: forcing the file to be stored in contiguous locations; or storing the sectors as a linked list, with each sector containing a pointer field to the next sector in this file; or storing an array of next sector pointers external to the sectors. The directory often contains a file length which can be used in determining when the end of file has been reached.

12 Translation of Logical File IO To Physical Disk IO : The Directory Typical directory entries (depending upon the operating system) contain: file name file length physical disk start location time & date last modified/last accessed/created various file attributes (normal, hidden, etc.)

13 File Allocation Units When space is required to store data which is part of a file, disk space is normally allocated (by the operating system) more than a single sector at a time; linking of the parts of a file together will typically be based on these larger groups, instead of on individual sectors. These allocation units are sometimes called clusters or granules.

14 File Starting Location The file starting location is often specified as an allocation unit (or cluster) number, instead of a cylinder/surface/track-sector set of values. Conversion of an allocation unit requires knowledge of the number of sectors per track and the number of tracks (surfaces) per cylinder; these pieces of information are contained as part of the data in the disks boot sector.

15 File Starting Location: Example What is the physical starting location of a file at allocation unit 50? Suppose we know the following (from the boot sector) 4 sectors / allocation unit (for all allocations) 12 sectors / track 8 tracks (surfaces)/cylinder Allocation unit 50 would be 200 (4x50) sectors from the beginning of the disk There are 96 (12x8) sectors per cylinder 200 sectors from the start of the disk represents 2 full cylinders plus an additional 8 sectors The file would start on the third cylinder, on the first surface, and the eighth track-sector.

16 End of Lecture

Download ppt "DAT2343 File Storage and Access © Alan T. Pinck / Algonquin College; 2003."

Similar presentations

Ads by Google