Operating System Hard Disc (PPT 6) Flashcards
What are the properties of a Hard Disc?
Hard discs have one or more circular platters which:
- are stacked one above each other
- read-write heads move in between platters
- each platter has two surfaces both carrying data
- each platter is partitioned into concentric tracks
- all outer most tracks together form a data cylinder
- all second tracks together form another cylinder
- heads are all at the same cylinder at any instant- only one cylinder can be accessed at any one time
What is the minimum unit of information which can be stored or read?
It is a block. Each track is divided up into these
What are the two types of file allocation?
Pre-allocation and Dynamic Allocation
What is Pre-allocation?
All space is allocated when a file is created
- Inflexible and inefficient
- Estimation of the file size needed which may be wrong
What is Dynamic Allocation?
Space is allocated as needed
-files can grow and shrink, no estimation needed
What is a Portion?
A contiguous chunk of free space on disc, composed of one or more consecutive blocks
What is a File Allocation Table?
Keeps track of portions allocated to a file
What is a Disc Allocation Table?
Keeps track of blocks or portions which are free on the disc
What does each FAT entry contain for contiguous allocation?
- file name
- start block
- no.of blocks in file
What allocation is used for Contiguous allocation?
Pre-allocation
What is a benefit and disadvantage of Contiguous allocation?
Fast random access to blocks within a file but portions of wasted space appear as files are erased and others are inserted
What does each FAT entry contain for chained allocation?
Exactly the same as for contiguous allocation (file name, start block, no. of blocks in file)
What allocation is used for Chained allocation?
Dynamic allocation, each block contains a pointer to the next block and the previous
What is a benefit and disadvantage of Chained allocation?
No portions wasted but random access may be slow
How does Indexed Allocation work?
Each file contains an index block. This contains pointers to all other portions in a file. The index block indicates start block and length of each portion of the file
What does each FAT entry contain for Indexed Allocation?
- File name
- index block
What is a benefit and disadvantage of Indexed allocation?
Good random access speed and sequential access is easy but since blocks are spread everywhere, there is a head movement penalty
What are the three methods to keep track of free space?
- Bit Table
- Chaining free blocks
- Indexed free portions
What is a Bit table?
Disc Allocation Table is a binary number with one bit for each block on disc. If a block is full, its set to 1, if not 0. Disc Allocation Table can be very compact
How does Chaining Free Blocks work?
Treat free space as a file and use the same chaining method to link all free blocks together. DAT not actually required, only need a pointer to first block in the chain
How does Indexed Free Blocks work?
Treat free space as a file and use existing allocation method. DAT is simply the index block that we would store under Indexed Allocation. DAT can be very big when there is lots of free space
What does NTFS stand for?
New Technology File System
What is a Sector?
It is similar to a block, smallest physical storage unit on the disc, usually 512 bytes but not always
What is a Cluster?
Similar to a portion, one or more contiguous sectors. Does need to be contiguous in a file. Cluster size is always a power of 2
What is a Volume?
It is a logical partition on disc, consisting of one or more clusters
What does a volume contain?
- file system information
- a collection of files
- unallocated space (free space)
What can a Volume be?
- 1 disc
- part of 1 disc
- spanning several discs
What is the fundamental unit of disc space on NTFS?
It is a cluster
What is the max file size in NTFS?
2^32 clusters, equal to 2^48 bytes
Name benefits of NTFS
It can easily support discs with differing sector sizes. It can also support large discs efficiently and large files by using larger cluster size. Cluster size for a volume is determined at format time
What does a NTFS volume contain?
-Partition Boot Sector
Contains info about volume layout,file system structures, boot start up info
-Master File Table
Contains info about files and folders on the volume and about unallocated space. Basically an index block and is organised in a relational database structure
-System Files
Includes log file and cluster bit map
Do all hard disc platters rotate at the same speed?
Yes they do, this is typically 7200 rpm but can vary
What is seek time?
It is the time to move the disc arm to the required track
What is rotational latency?
It is the wait time for the correct block to come round under the head.
Which file allocation method best takes advantage of locality of reference?
Contiguous allocation method best takes advantage. Files are kept together in consecutive blocks so rotational latency and seek time wont be that long. To a lesser extent, the variations of Chained and Indexed allocation when portions are used can also exploit this.
What are the six disc scheduling policies?
- LOOK
- C-LOOK
- Shortest Service Time First
- FIFO
- LIFO
- Priority
What is FIFO?
First In First Out
Fairest method of them all, no starvation. Has a reasonable performance if a small number of processes are competing for the hard disk. If a large number are competing however, we will jump all over the disk
What is LOOK?
This is when the disk arm only moves in one direction. It services all requests until no more are needed in one direction then comes back around and does the rest in the other. It avoids starvation but doesn’t take advantage of locality of reference
What is C-LOOK?
Modification of LOOK where the direction is only one way. Once finished, the head returns to the start, without servicing requests
What is Shortest Service Time First?
The request with the shortest seek time is chosen first. This should be quite efficient as it reduces arm movement and takes advantage of locality of reference. However, it can lead to starvation if new requests come in which are closer than older further away requests
What is LIFO?
Last In First Out
The most recent request is serviced first. Takes advantage of locality of reference as if a process gets several requests in together they will all be serviced. However, starvation is possible
What is Priority?
Requests made by short interactive jobs may be given a higher priority than others. Not intended for optimised disk I/O efficiency, more for getting short jobs through quickly and give better interactive I/O performance. Long jobs may have to wait and therefore be starved