1. What is the difference between primary storage

1. What is the difference between primary storage and secondary storage?
Primary Storage is …
- Limited
- Volatile
- Expensive
- Fast (May be accessed directly from
the CPU)
- Retrieving a single character from
RAM takes about 150 nanoseconds
(150 billionths of a second)
Secondary Storage is …
- Extendible
- Persistent
- Cheap
- slow (must be copied to main memory
before being accessed by the CPU)
- Retrieving the same character from disk
takes about 75 milliseconds (thousandths of
a second)
- 75 msec is 500,000 times longer than
Primary Storage.
2. What are the two major types of secondary storage devices?
a. Direct Access Storage Devices (DASDs)
- Offer high storage capacity and low cost
- Data stored as magnetized areas on magnetic platters
- surfaces
- Each disk has one or more platters
- A disk pack contains several magnetic platters connected to a rotating spindle
Examples:
- Magnetic Disks
Hard Disks (high capacity, low cost per bit)
- Optical Disks
CD-ROM, DVD-ROM (Read-only/write-once, holds a lot of data,
Cheap)
b. – Serial Devices
- Magnetic Tapes
3. Describe the structure of the magnetic disk?
-
Magnetic disks support direct access to a desired location and consisted of :
Disk blocks
Tracks
Platters
Cylinder
Sectors
Disk heads
Disk Controller
Seek Time
Rotational delay
-
-
-
Some disks have fixed-heads
- As many read/write heads as there are tracks on the platter
- Track is selected electronically and is therefore much faster
- Cost of additional read/write heads is the limiting factor to production
- Disks with an actuator are called moveable-head disks
Actuator moves the (single) read/write head per platter to the appropriate
track
Disks are divided into concentric circular tracks
On each platter surface
- Track capacities vary typically from 4 to 50 Kbytes
- The division of the disk into sectors is hard-coded and may not be
changed
- Subtended at fixed angle at the center of a platter are sectors
- Not all disks have their tracks divided into sectors
4. How to calculate disk capacity?
- Number of cylinders = number of tracks in a surface
- Track capacity = number of sector per track × bytes per sector
- Cylinder capacity = number of surfaces × track capacity
- Drive capacity = number of cylinders × cylinder capacity
Knowing these relationships allows us to compute the amount of disk space a
file is likely to require
5. How many cylinders to store a file with 20,000 fixed length records of 256 bytes each on a disk
with 512 bytes per sector, 40 sectors per disk and 11 tracks per cylinder?
Answer –
- The file is 20,000 * 256 = 5,120,000 bytes
- 5,120,000 / 512 = 10,000 sectors
- 10,000 / 40 = 250 tracks
- 250 / 11 = 22.72 cylinders
- If 22.72 physically contiguous cylinders are not available then the file will
have to be spread out over the disk (fragmentation)
6. How can data organized on disks?
Data can be organized on disk in two different ways:
1. Sectors
- Physically placement of sector
- Adjacent sectors
- Interleaving Sectors
- Clusters
- Extents
2. User defined blocks.
7. How can data organized on disks using Physical placement of sectors?
a. Adjacent sectors: fixed size segments of a track used to hold a file
 Disadvantage: physically it is not possible to read a series of sectors
on the same track, after reading one sector , the disk controller take a
certain amount of time to transfer data , the start of the next sector will
be lost ( able to read only one sector / revolution)
b. Interleaving sectors: leave an interval of several fixed sectors between
adjacent logical sectors. The following figure indicates interleaving factor =
8. How can data organized on disks using Clusters?
- The operating system file manager maps using FAT (File Allocation Table)
the logical parts of the file to their corresponding physical locations to
improve performance.
- The file is viewed as a set of a fixed number of contiguous sectors that can be
read without requiring additional seeks called clusters.
- FAT: contains a list of all the clusters in a file. Each cluster entry in the FAT
giving the physical location of the cluster.
9. How can data organized on disks using extents?
 An extent is a file stored in contiguous sectors, track and cylinders
 Its clusters are contiguous.
 The whole file can be accessed with minimum amount of seeking.
 An extent is possible if a disk has a lot of free space.
 If no contiguous free space for a file the file can be stored in two or more extents.
10. Define Internal Fragmentation of a disk?
 Internal fragmentation of a disk is the unused disk space which cannot be used by
other files.
 To Store a file of 300-byte records in a disk of sector size 512 bytes.
- Store a record in a sector. This will cause the loss of disk space, i.e., internal
fragmentation.
- Allow records to span in two sectors. This will save disk space. But, it may
require the retrieval of two sectors when accessing a record.
 If the number of bytes in a file is not a multiple of the cluster size, internal
fragmentation will occur in the last extent of the file.
11. Describe how can data organized on a disk using blocks?
 Disk tracks can be divided into integral numbers of user-defined blocks.
 Block size can have fixed or variable length.
 In block organization, different amount of data can be transferred in a single I/O
operation.
 A block organization does not have sector-spanning and fragmentation problems.
- track organization by sectors
- track organization by blocks
 A block may contain one or several records.
 Each block is usually accompanied by one or more subblocks containing extra
information about the data blocks.
- Count subblock: counting the number bytes in the accompanied data block.
- Key subblock: containing the key for the last record in the data block.
- When key subblocks are used, a track can be searched by the disk controller
for a block or record identified by a given key.
- This search is more efficient than sector-addressable schemes because it does
not load the keys into primary memory.
12. What are Blocks? And why are they important?
- A track is divided into blocks or pages
- Block size (generally) fixed for each operating system
- Typical block sizes range from 512 bytes to 4096 bytes (4 kB)
- A disk with hard-coded sectors often has the sectors further subdivided onto
blocks
- Importance :Whole blocks are transferred between disk and main memory
for processing
13. What is the difference between a cluster and FAT?
- A cluster is a fixed number of contiguous sectors
- All clusters on a disk are the same size
- To view a file as a series of clusters and still maintain the sectored view, the
file manager ties the logical sectors to the physical clusters using a file
allocation table (FAT)
- The file manager allocates an integer number of clusters to a file. An
example: Sector size: 512 bytes, Cluster size: 2 sectors
- If a file contains 10 bytes, a cluster is allocated (1024 bytes).
- There may be unused space in the last cluster of a file.
- This unused space contributes to internal fragmentation
The FAT contains a linked list of all the clusters in a file, ordered according to the logical
order of the sectors in a cluster
- With each entry in the FAT is an entry giving the physical location of the
cluster
14. How can operating system Read a particular byte from a disk file?
-
The computer operating system find the correct surface, track and sector ,
reads the entire sector into a special area of memory called buffer
And then find the requested byte in the buffer.
15. How to choose cluster size?
- Some OS allow the system administrator to choose the cluster size.
- When to use large cluster size?
- – When disks contain large files likely to be processed sequentially.
Example: Updates in a master file of bank accounts (in batch mode)
- When to use Small cluster size?
- – When disks contain small files and/or files likely to be accessed randomly
Example : online updates for airline reservation
16. Describe what is mean by Overhead?
a. Preformatting overhead for sector-addressable disks
- Stored at the beginning of each sector, including information about
sector address, track address, and condition (whether the sector is
usable or defective).
- Preformatting also involves placing gaps and synchronization marks
between fields of information.
b. Nondata overhead for block-addressable disks
- Subblocks and interblock gaps.
- Block factors: number of bytes per track/block length.
- In general, block factors is the greater the better.
- However, larger blocks have higher potential of internal track
fragmentation.
17. Calculate the space on the disk used to store a file?
Suppose we need to store a file with 50,000 fixed length data records on a disk with the following
characteristics:
- Number of bytes/sector = 512
- Number of sectors / track = 63
- Number of tracks / cylinder = 16
- Number of cylinders = 4096
a. How many cylinders does the file require if each data record requires 256
bytes?
Number of sectors for a file = (50000* 256) /512 = 25 000 sector
Cylinder size = 16 track * 63 sector * 512 byte = 516096
Cylinders for the file = 50000* 256 / Cylinder size (516096) = 24.8 cylinders
Of course it may be that the disk does not have 24.8 physically contiguous cylinders
available. So the file has to be spread out over dozens even hundreds of cylinders.
18. A Disk drive have 20 000 byte / track, the amount of space taken by blocks and inter block gaps
= 300 byte/block.
We need to store file with 100 byte/ record.
a. How many records can be stored per track if the blocking factor is 10 ?
Blocking factor = 10
Each block holds
= 10 (block factor) * 100 (record size) + 300 (block data)
= 1300 byte.
The number of blocks that can fit on 20 000 track
= 20000 / 1300 = 15.38 = 15 block.
Number of records can be stored = 15 block * 10 record = 150 record.
b. How many records can be stored per track if the blocking factor is 60 ?
Blocking factor = 60
Each block holds
= 60 (block factor) * 100 (record size) + 300 (block data)
= 6300 byte.
The number of blocks that can fit on 20 000 track
= 20000 / 6300 = 3 block.
Number of records can be stored = 3 block * 60 record = 180 record.
c. What do you understand from the above results?
The larger blocking factor can lead to more efficient use of storage
19. Consider the following parameters of a disk:
Disk capacity = 20000 MB
Tracks per recording surface = 100
Number of recording surfaces = 10
Bytes per sector = 512
Min. seek time = 2 ms
Avg. seek time = 8 ms
Spindle speed = 10000 rpm (Assume 1 MB=1024 B)
a. How many cylinders are there?
Number of cylinders = Number of tracks per surface
= 100 tracks/surf
= 100 cylinders
b. What is the capacity of a cylinder?
Cylinder capacity = Total disk Capacity / No. of cylinders
= 20000 MB / 100 cylinders
= 200 MB/cylinder
c. What is the capacity of each recording surface?
Surface Capacity = Total disk Capacity / No. of recording surfaces
= 20000 MB / 10 surfaces
= 2000 MB/surface
d. What is the capacity of one track?
Track Capacity = Surface Capacity / No. of tracks per surface
= 2000(MB/surf) / 100(tracks/surf)
= 20 MB/track
e. How many sectors are there in one track?
Number of sector in one track = 20(MB/track)/512(B/sector)
= 20*1024/512 sectors/track
= 40 sectors/track
f. What is the average rotational delay?
Spindle speed = 10000 rpm = 10000 rotations/60 sec
Max rotational delay = 60*1000 ms/10000 rotations = 6 ms
Min rotational delay = 0 ms
Average rotational delay = expected value of rot. delay = (6ms+0)/2 = 3 ms
g. What is the time to find and read one sector?
Time find and read one sector =
Average seek time + average rot. Delay + time to read (max rotational delay)
= 8+ 3 + 6/(40) = 11 + to 3/20 = 11.15 ms
20. Assume that a disk drive uses block addressing.
 The following subblock organization for nondate is available:
- Countdata, where the extra space used by count subblock.
- Interblock gaps is equivalent to 95 Bytes.
This disk has 17017 usable Bytes per track, 30 tracks per cylinder, and 496 cylinders per drive.
Suppose you have a file with 350,000 60Byte records that you want to store on this drive. Answer
the following questions.
Unless otherwise directed, assume that the blocking factor is 10 and that the Countdata subblock
organization is used.
a. How many blocks can be stored on one track?
Block size = Blocking Factor * Record Size + Interblock gap
=
10 *
60 + 95 Bytes
= 695 B
Number of blocks per track = Track size / Block size
= 17017 B / 695 (B/block)
= 24 blocks/track
b. How many records can be stored on one track?
Number of records/ track = (Number of blocks /track) * (Number of records/block)
= 24 blocks/track * 10 records/block = 240 records/track
c. How many cylinders are required to hold the file (blocking factor 10 and
Countdata format)?
Number of records/Cylinder = 240 rec/track * 30 tracks/cylinder = 7200
records/cylinder.
Number of cylinder required to hold a file =
Number of records in file / number of records in cylinder =
350000rec in file /7200 rec in cylinder = 49 cylinders for the file
d. How much space will go unused totally due to internal track fragmentation and
count subblocks?
Total file is 350000 records = 350000 / 10 records per block = 35000 blocks.
For each block 95 B/block is unused because of count subblock,
Total unused space for count subblocks
= (95 unused space /block) * Number of blocks
= 95 * 35000
= 3325000 B.
Number of blocks in one track = (17017 / 695 ) = 24 Block and 337 due to internal
fragmentation for one track.
Number of tracks in the file = 35000 (block/file) /24 (block/track) = 1459 tracks/file.
Total unused space for internal fragmentation
= Number of tracks in file * unused fragmentation for one track
=
1459
*
337 B
= 491683 B.
Therefore the total unused space
= Count subblock unused space + fragmentation unused space
=
3325000
+ 491683 B
=
3816683 B
In the rest of the questions assume that the file is organized into clusters and extents.
Suppose the cluster size = 4 blocks and extent size = 15 clusters.
e. How many clusters are needed to store this file?
Number of clusters in file = Number of blocks in file / Cluster size
= (350 000 records / 10 (rec/block)) /4 (blocks per cluster)
= 8750 clusters
f. What is the number of extents?
Number of Extents in file = Number of Clusters in file / extent size
= ceiling (8750 clusters/ (15 clusters/extent))
= 584 extents
21. What are the factors that affect the cost of disk access?
- Seek time: the time required to move the access arm to the correct cylinder.
- average seek time
- Rotational delay: the time required to rotate the disk so the desired sector can be
placed under the read/write head.
- Maximum rotational delay: time for one resolution
- Average rotational delay: half of maximum rotational delay
- Transfer time: the time required to read the data from the disk
(Number of bytes transferred ¸ number of bytes on a track) * Rotation time
or
(Number of sectors transferred ¸ number of sectors in a track) * Rotation time