- - (***). - ---------------------------------------- (***) mount, - 50 , umount. , . - +-----------------+ +-----------------+ | | |+----+ +----+| +----+ | 0 4 |---- ++ 28 ++ ++ 4 ++ | 64 | | | +----+| |+----+ +----+ +-----------------+ | +------+ | | +----+| +----+| +----+ | 1 4 |---- | 17 || ++ 5 ++ ++ 97 ++ | | +----+| |+----+ +-++----+| +-----------------+ +---|--------+ +------+ | | +----+ |+----+ |+----+ | 2 4 |---- | 98 |+---+| 50 | ++ 10 ++ | | +----+| +----+ +----+| +-----------------+ | | | | +----+| +----+ +----+| | 3 4 |----+>| 3 ++ | 35 | | 99 || | | | +----+ +----+ +----+| +-----------------+ | | +-----------------+ | | | +----+ | | | | | |<---------------------------------+ +-----------------+ 99, 3.11. , "" . - , - . , , - , . - , . , - , , , . , "" - . , , , , - , , - . , - , , - , . - , , - , - . 3.4  , , - . 51 A B C +------------------------------------------------------------- | b - - | - - | - - | - - | - - - | - - | - - | - - - | - - - | - b - | - - - | - - | - , - | - - | - - - | - - | - - | - - | - - ( 4) | +---------------------------+ - - | | - , | - - | | | - - | +---------------------------+ - - | brelse(): - - | - - | - - , | - - | - - | - - b | - - | - - | - - b' | - - | - b - | - - | - - | - - | v 3.12. ( 3.13), getblk . , - . , - "" , -. , , . , , - -, ; . , , ; - , , 52 +------------------------------------------------------------+ | bread /* */ | | : | | : , | | { | | ( getblk); | | ( ) | | ; | | ; | | ( ); | | (); | | } | +------------------------------------------------------------+ 3.13. . 5 , ( ) , . - -, , , , . breada (- 3.14). , , , . - , . , - . , , - . ; , - , ( brelse). , . , -, , , - , . , , , - - . , - breada, , , , . ( 3.15) . , , - , -- . , - , . , , . , -. , , . "- ", , - brelse, -. - , , getblk ( 3). , , , - 53 +------------------------------------------------------------+ | breada /* */ | | : (1) | | | | (2) | | | | : , | | { | | ( ) | | { | | ( getblk);| | ( ) | | ; | | } | | ( ) | | { | | ( getblk);| | ( ) | | ( brelse); | | | | ; | | } | | ( ) | | { | | ( bread); | | ; | | } | | ( , | | ); | | ; | | } | +------------------------------------------------------------+ 3.14. ; , . . +------------------------------------------------------------+ | bwrite /* */ | | : | | : | | { | | ; | | (- ) | | { | | ( -); | | ( brelse); | | } | | ( | | ) | | | | "" ; | | } | +------------------------------------------------------------+ 3.15. 54 , , - . , ; getblk ( 3) "" . , brelse; "" , "". - - - - brelse . - , - , , brelse . 3.5  , , - , , . * - , -- . , , , , . - , , - , - . , - . * , -, . - , .. . . - , , - UNIX. - ( ), - , . * , - . - , , - - . " ", - , . , . , , , , - : , , - . * - , , , . - , - 55 (, getblk) - , . * - , . - , , . , , : - , , , (****). * - . , , ; , , , . - , - , ( getblk - ) , . 3.6  , . - , - . - , , - , , , , . , , - . - , " - " - , , . - , . . getblk , , . , , . , - . , , . bread - . bwrite . , " ", -. , - --------------------------------------- (****) - fflush. . , - . 56 , , . , , -. . - , - , , , . , - . , , . , - , , , . 3.7  1. 3.3. , -. - ? - ? 2. getblk, , , . ? *3. getblk - , . ( .) ? 4. brelse "" - , . , - - ? 5. , . , ? - ? *6. , , , , "- " . getblk , . 7. getblk brelse , , , " - ". . 8. bread, . *9. , breada. - bread breada, ? breada, , - , . ? 10. , . getblk. 11. , umount sync ( 5), - , , " " . - , . - ? , - " " , 57 - ? 12. . - , . , . - ? 58