Hard disks are part of disk drives that store and provide quick access to large amounts of data on electromagnetically charged surfaces. They have large storage capacities, use metallic platters for storage, and are faster than floppy disks or CD-ROMs. Hard disks store programs, operating systems, and personal files, retaining data even when the computer is off. There are three types: digital versatile discs, external hard disks, and internal hard disks. However, hard disks can eventually fail and stop the computer from working, and head crashes can damage disks and cause data loss.
The document discusses various aspects of file systems and storage management in operating systems. It covers topics like file attributes, operations, structures, access methods, directory structures, file sharing, consistency semantics, and protection. File attributes include the file name, size, type and protection attributes. Common file operations are creating, reading, writing and deleting files. Files can have sequential, direct or indexed access methods. Directory structures can be single-level, two-level, tree-structured or graph-based. File sharing requires consistency models like Unix, session or immutable semantics. Protection controls access via access matrices, access control lists or capability lists.
6. 畛 truy xu畉t 1 sector c畉n ph畉i ch畛 ra v畛 tr鱈 c畛a sector 坦. V畛 tr鱈 sector
動畛c th畛 hi畛n b畉ng 3 th担ng s畛: ch畛 s畛 sector, track v head
Head 動畛c 叩nh s畛 t畛 tr棚n xu畛ng b畉t 畉u t畛 0
Track 動畛c 叩nh s畛 theo th畛 t畛 t畛 ngoi vo b畉t 畉u t畛 0
Sector 動畛c 叩nh s畛 b畉t 畉u t畛 1 theo chi畛u ng動畛c v畛i chi畛u quay c畛a
挑a
畛a ch畛 sector v畉t l箪 c坦 k箪 hi畛u: (sector, track, head)
Hm truy xu畉t m畛c v畉t l箪 trong C for DOS:
int biosdisk (int cmd, int drive, int head, int track, int sector, int
nsects, void *buffer)
Hm truy xu畉t m畛c v畉t l箪 trong C for Windows ???
6
7. Access time = Seek time + Rotational time + Read time
7
8. Do truy xu畉t m畛c v畉t l箪 ph畉i d湛ng 畉n 3 tham s畛 r畉t b畉t ti畛n n棚n t畛 ch畛c logic
動畛c 動a ra 畛 d畛 hi畛u, d畛 thao t叩c, d畛 t鱈nh to叩n h董n
Cylinder: l t畉p c叩c track c坦 c湛ng b叩n k鱈nh (c湛ng s畛 hi畛u) tr棚n t畉t c畉 c叩c m畉t
Nh畉n x辿t: truy xu畉t sector theo t畛ng cylinder s畉 畉m b畉o sau khi truy xu畉t
sector K th狸 truy xu畉t sector K+1 l nhanh h董n so v畛i t畉t c畉 c叩c sector kh叩c
T畛 ch畛c logic l m畛t d達y sector 動畛c 叩nh ch畛 s畛 theo theo t畛ng cylinder, b畉t
畉u t畛 0
M畛i l畉n truy xu畉t (畛c/ ghi 挑a) ch畛 c坦 th畛 th畛c hi畛n tr棚n N sector li棚n ti畉p
(N>=1)
Hm truy xu畉t m畛c logic trong C for DOS:
int absread (int drive, int nsects, long lsect, void *buffer).
int abswrite (int drive, int nsects, long lsect, void *buffer);
Hm truy xu畉t m畛c logic trong C for Windows ???
8
0 1 2 3 4 N-1
9. Sector v畉t l箪 Sector logic
l = t*st*hd + h*st + s -1
Sector logic Sector v畉t l箪
s = (l mod st) + 1
t = l div (st * hd)
h= (l div st) mod hd
Trong 坦:
l : ch畛 s畛 sector logic st : s畛 sector /track
h : ch畛 s畛 head th : s畛 track /side (head)
t : ch畛 s畛 trackhd : t畛ng s畛 side (head)
s : ch畛 s畛 sector v畉t l箪
9
39. 39
boot block super block I-node files and directories
Gi叩n ti p c p 1:畉 畉
c p ny tr t i 256畉 畛 畛
a ch . T ng 256KB畛 畛 畛
Gi叩n ti p c p 2:畉 畉
256*256 = 65 MB
Gi叩n ti p c p 3:畉 畉
256*256*256 =
16GB