Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 3 Secondary Storage and System Software I

Similar presentations


Presentation on theme: "Lecture 3 Secondary Storage and System Software I"— Presentation transcript:

1 Lecture 3 Secondary Storage and System Software I
File Organization

2 Previous Lecture

3 Lecture 3 Fundamental File Processing Operations
Physical and logical file. Opening files. Closing files. Reading and writing. Seeking. Special Characters in files. Physical devices and logical files.

4 Today Lecture

5 Chapter 3 Secondary Storage and System Software I
Disks Secondary Storage and System Software II Tapes Secondary Storage and System Software III CD-ROM and Buffer Management

6 Lecture Outline The Organization of Disks
Estimating Capacities and Space Needs Organizing Tracks by Sector Organizing Tracks by Block The Cost of a Disk Access

7 Lecture Objectives Describe the organization of typical disk drives, including basic units of organization and their relationships. Identify and describe the factors affecting disk access time, and describe methods for estimating access times arid space requirements.

8 Section 3.1 Disks

9 General Overview Having learned how to manipulate files
The nature and limitations of the devices and systems used to store and retrieve files Design good file structures arrange the data in ways that minimize access costs given the device used by the system.

10 Disks and Serial Devices
Disks belong to the category of Direct Access Storage Devices (DASDs) They make it possible to access the data directly. This is in contrast to Serial Devices (e.g., Magnetic Tapes) allows only serial access [all the data before the one we are interested in has to be read or written in order].

11 Different Types of Disks
Hard Disk: High Capacity + Low Cost per bit. Floppy Disk: Cheap, but slow and holds little data. (zip disks: removable disk cartridges) Optical Disk (CD-ROM): Read Only, but holds a lot of data and can be reproduced cheaply. However, slow.

12 The Organization of Disks I
The information stored on a disk is stored on the surface of one or more platters. The information is stored in successive tracks on the surface of the disk. Each track is often divided into a number of sectors which is the smallest addressable portion of a disk.

13 The Organization of Disks II
When a read statement calls for a particular byte from a disk file: OS finds the correct platter, track and sector, reads the entire sector into a special area in memory called a buffer, and then finds the requested byte within that buffer.

14 The Organization of Disks III
Disk drives typically have a number of platters and the tracks that are directly above and below one another form a cylinder. All the info on a single cylinder can be accessed without moving the arm that holds the read/write heads. Moving this arm is called seeking. The arm movement is usually the slowest part of reading information from a disk.

15 Schematic illustration of disk drive

16 Real View

17 Disk Structure

18 Surface of disk showing tracks and sectors

19 Schematic illustration of disk drive viewed as a set of seven cylinders.

20 Capacities Track Capacity = number of sectors per track * bytes per sector Cylinder Capacity = number of tracks per cylinder * track capacity Drive Capacity = number of cylinders * cylinder capacity

21 Example Store a file with 50,000 fixed-length data records on computer disk: Number of bytes per sector = 512 Number of sectors per track =63 Number of tracks per cylinder = 16 Number of cylinders = 4092 How many cylinders does the file require, each data record requires 256 bytes? Since each sector can hold two records, the file requires = sectors One cylinder can hold 63 X 16 = 1008 sectors. The number of cylinders = 24.8 cylinders Of course, it may be that a disk drive with 24.8 cylinders of available space does not have 24.8 physically contiguous cylinders available. In this likely case, the file might, in fact, have to be spread out over dozens, perhaps even hundreds, of cylinders.

22 Data Organization Organizing Tracks per Sector I
The Physical Placement of Sectors The most practical logical organization of sectors on a track sectors are adjacent, fixed-sized segments of a track that happens to hold a file. Physically, this organization is not optimal After reading the data, it takes the disk controller some time to process the received information before it is ready to accept more. If the sectors were physically adjacent, we would use the start of the next sector while processing the info just read in.

23 Data Organization Organizing Tracks per Sector II
Traditional Solution Interleave the sectors. Namely, leave an interval of several physical sectors between logically adjacent sectors. Nowadays, the controller’s speed has improved so that no interleaving is necessary anymore.

24 Two views of the organization of sectors on a thirty-two-sector track.

25 Data Organization Organizing Tracks per Sector III
The file can also be viewed as a series of clusters of sectors which represent a fixed number of (logically) contiguous sectors. Once a cluster has been found on a disk, all sectors in that cluster can be accessed without requiring an additional seek. The File Allocation Table ties logical sectors to the physical clusters they belong to.

26 The file manager determines which cluster in the file has the sector that is to be accessed.

27 Data Organization Organizing Tracks per Sector IV
If there is a lot of free room on a disk, it may be possible to make a file consist entirely of contiguous clusters. the file consists of one extent. the file can be processed with a minimum of seeking time. Cylinders form one contiguous whole. If one extent is not enough, then divide the file into more extents. As the number of extents in a file increases, the file becomes more spread out on the disk, and the amount of seeking necessary increases.

28 File Extents

29 Data Organization Organizing Tracks per Sector V
There are 2 possible organizations for records (if the records are smaller than the sector size) Store 1 record per sector Store the records successively (i.e., one record may span two sectors)

30 Alternate record organization within sectors

31 Data Organization Organizing Tracks per Sector VI
Advantage of 1 Each record can be retrieved from 1 sector. Disadvantage of 1 Loss of Space with each sector Internal Fragmentation Advantage of 2 No internal fragmentation Disadvantage of 2 2 sectors may need to be accessed to retrieve a single record.

32 Data Organization Organizing Tracks per Sector V
The use of clusters also leads to internal fragmentation. A cluster consist of three 512-byte sectors A file contains 1 byte 1535 bytes would be wasted due to internal fragmentation

33 Data Organization Organizing Tracks per Block I
Rather than being divided into sectors the disk tracks may be divided into user-defined blocks. When the data on a track is organized by block, this usually means that the amount of data transferred in a single I/O operation can vary depending on the needs of the software designer (not the hardware). Blocks can normally be either fixed or variable in length depending on the requirements of the file designer and the capabilities of the operating system.

34 Sector organization versus block organization

35 Data Organization Organizing Tracks per Block II
Blocks do not have the sector-spanning and fragmentation problem of sectors since they vary in size to fit the logical organization of the data The blocking factor indicates the number of records that are to be stored in each block in a file Each block is usually have subblocks count-subblock: No. of bytes in the data block key-subblock: The key of the last record

36 Block Addressing

37 Non-Data Overhead I Whether using block or sector organization
some space on the disk is taken up by non-data overhead information stored on the disk during pre-formatting. On sector-addressable disks, pre-formatting involves storing, at the beginning of each sector, sector address, track address and condition (usable or defective) gaps and synchronization marks between fields of info to help the read/write mechanism distinguish between them.

38 Non-Data Overhead II On Block-Organized disks, subblock + interblock gaps have to be provided with every block. The relative amount of non-data space necessary for a block scheme is higher than for a sector- scheme.

39 Non-Data Overhead III Example
10 x 100-byte record / block Block holds bytes Track of 20,000 bytes has 15 blocks with 150 record 60 x 100-byte record / block Block holds bytes Track of 20,000 bytes has 3 blocks with 180 record The larger blocking size always lead to more efficient storage? The greater the block-size, the greater potential amount of internal track fragmentation (within a track).

40 Non-Data Overhead IV The flexibility introduced by the use of blocks rather than sectors can save time it lets the programmer determine how the data is to be organized physically on disk. The programmer and Operating System have to do more work for overhead. Cannot synchronize I/O operation with movement of disk.

41 The Cost of a disk Access
Seek Time is the time required to move the access arm to the correct cylinder. Rotational Delay is the time it takes for the disk to rotate so the sector we want is under the read/write head. Transfer Time Number of Bytes Transferred = —————————————— x Rotation Time Number of Bytes on a Track

42 Disk as Bottleneck I Processes are often Disk-Bound
The network and the CPU often have to wait inordinate lengths of time for the disk to transmit data. Solution 1 Multiprogramming (CPU works on other jobs while waiting for the disk) Solution 2 Striping: splitting the parts of a file on several different drives, then letting the separate drives deliver parts of the file to the network simultaneously (Parallelism)

43 Disk as Bottleneck II Solution 3
RAID: Redundant Array of Independent Disks Solution 4 RAM disk: Simulate the behavior of the mechanical disk in memory. Solution 5 Disk Cache: large block of memory configured to contain pages of data from a disk. Check cache first. If not there, go to the disk and replace some page already in cache with page from disk containing the data.

44 Assignment Write on the 3 solutions that can overcome the problem of “Processes are often Disk-Bound”

45 Next Lecture

46 Secondary Storage and System Software II
Description of Tape Systems Organization of Data on Nine-Track Tapes Estimating Tape Length Requirements Estimating Data Transmission Times Disk versus Tape

47 Questions?


Download ppt "Lecture 3 Secondary Storage and System Software I"

Similar presentations


Ads by Google