Download Understanding Secondary Storage: Allocation Schemes and File Systems and more Study notes Computer Science in PDF only on Docsity! 1 need for secondary storage • we have memory, why need secondary storage? – “price” of ram too much – multiple users, shared access. – memory gets destroyed on power off. databases need info to stay around • File – named collection of related information recorded on secondary storage (usually disk, sometimes memory) Why does disk access take so long relative to memory? • Ans (most important) - seek time – time it takes to move the read-write head to the proper cylinder. Mechanical arm can only move so fast . [show diagram of platters, read head, arm, etc] • some rotational latency • sectors, blocks, tracks, platters, read head 2 Disk Controller • disk drive has a disk controller which manages the disk drive on behalf of the operating system. • Device controllers vary from manufacturer to manufacturer. • Device drivers usually come with the device and enable communication with controller. • abstraction – device drivers hide differences among device controllers. Similarities between memory and disk • both can be visualized as a linear array which has to be allocated. • memory – allocate memory to a process • disk – allocate disk to files • given array, how do you allocate storage to the files? – sound like a familiar problem? . 5 3. FAT – file allocation table • - used in dos and early windows • alternative to linked. move pointers out of the blocks and into a central table in memory. • like an array. each entry has pointer to next • scan memory rather than scanning the disk blocks. Much faster • drawback – need entire table in memory. large amount of space! • Size is proportional to disk size 4. Indexed allocation • allocate array to hold pointers to physical block • adv – allocate in memory at moment file is used. how does this compare to FAT? Why is it “better”? – random access is easy. Only 1 lookup to access nth block. how many accesses for FAT? – Low fragmentation • disadv – blocks can still be allocated randomly over disk. Seek time • multi level index 6 I – Nodes in UNIX • I- node short for index node. broken into 3 parts • 1) metadata 2) some actual data 3) pointers to disk blocks • Roughly – if file is small, data of file is stored within inode – if file is larger than data section of inode, use fixed pointers to data blocks (direct pointers) more i-nodes • after dataspace used in inode, and in direct pointers, os allocates new block of only direct pointers. • If file grows even larger ->index block pointing to another index block • End effect is random access of smaller files is good, since store within the inode itself. but can handle really large files without being inefficient.