:



         ,    -
        ,  
,           
  .         
,       ,      
   ,         -
    .       copy,
     1.3:         
      .  ,      
        ,        
     . ,    -
        , -
    .       , 
    ,      , -
    .     ,  -
      .      ,
      ,      
  ,     .  -
   ,        
      - .
                 
      ,      
        -   
  .          -
  ,       -
,     (*)     ,  -
    .
      2.1 ,       -
            
(-  ).        -
 -   .        ,
         ,  , 
           . -
, ,   ,      ,  
 ,      .   -
            , ,
         -
 ,    .       
          -
    ,     .  
    ,      -
   .



-----------------------------------------
(*)      ,   -
        ,    .


                                     39



              -
,           
 .      :  -
,    ,   ,    -
,   .    -
         ,   
  ""     ,      -
,            .
               
    ,     , 
    .     -
   ;      ,  
 ,       ,  
       .     
       .    
        ,    
,         , , ,
     .  ,  ,  
         , A  B.    
   A,     B,       
    B,          .
,    ,      
 ,  ,      -
.
      ( 3.1)   " "    
"  ",         -
      .   -   -
   
                       +------------------+
                       |   |
                       +------------------+    
                       |        |    
                       +------------------+   +------------->
            |     |   |
        +------------------+   |
       -    |            ------+---+
     <-------------+   +------------------+
                   |   |            ------+----------------->
                   |   +------------------+    
                   +---+------            |    
                       +------------------+    -
                       |            ------+---+
                       +------------------+   |
     <-----------------+------            |   |
            +------------------+   +------------->
                                
                               
                                                

                 3.1.  

(.   2.2.1),      ().  -
        ,    
        ,   ,  
     .     -
     :
*    ( " ()"  "" -

                                     40

  ,  ,    ""  ""),
*    ,
*         ,  -
   ;   ,  ",  ",
*        ,
*    .
           ,  
    ,     
 ( ),         -
.




            ,   
,       :    
    

+----------------------------------------------------------------+
|                                                 |
|  +-------------------+    +-------+    +-------+    +-------+  |
+->|    |--->|  |--->|  |--->|  |--+
+--|   |<---|   1   |<---|   2   |<---|   n   |<-+
|  +-------------------+    +-------+    +-------+    +-------+  |
|                                                  |
+----------------------------------------------------------------+
                            

                          
+----------------------------------------------------------------+
|                                                 |
|  +-------------------+                 +-------+    +-------+  |
+->|    |---------------->|  |--->|  |--+
+--|   |<----------------|   2   |<---|   n   |<-+
|  +-------------------+                 +-------+    +-------+  |
|                                                  |
+----------------------------------------------------------------+

            3.2.   


       ,      -
 .     ,    
   .      -
          
         ( 3.2).      
 .     ,      
""  ,         , 
      .   ,         
     .     
,      ,   ""  (  -
  ),       .      
          ""  
(  3.2). ,  ,     ""
,     ,  ,  -
  "" .
         ,       -
     .  ,  -
      ,      ,

                                     41

      .  -    -
             
,          -
.       -     
 ,      .    -
     ,     
-,       ,    
    .    -
 -    .

     -
      +-----------------+
      |                 |      +----+     +----+     +----+
 <----|  0  4 |------| 28 |-----|  4 |-----| 64 |---->
      |                 |      +----+     +----+     +----+
      +-----------------+
      |                 |      +----+     +----+     +----+
 <----|  1  4 |------| 17 |-----|  5 |-----| 97 |---->
      |                 |      +----+     +----+     +----+
      +-----------------+
      |                 |      +----+     +----+     +----+
 <----|  2  4 |------| 98 |-----| 50 |-----| 10 |---->
      |                 |      +----+     +----+     +----+
      +-----------------+
      |                 |      +----+     +----+     +----+
 <----|  3  4 |------|  3 |-----| 35 |-----| 99 |---->
      |                 |      +----+     +----+     +----+
      +-----------------+

                  3.3.   -


      3.3    -:   -
     ,       -
   -. ,     28,  4    64
    -  " 0  4".  
        -; 
          ,
    .  ,    -
         -
   ;        -
.
           -,     
  .   ,       -
           ;  
            -
       .   ,    
  ,    "".    
      -     ,   
   .   -,    
  ,       , 
      .     , 
          -
,          -    
.   :      -,   
   ,    .




                                     42





        2.1,   ,  -
    ,     -
    .       -
      ,     
 . ,       ,  
,            -
   ,        4. -
      ,  , -
     ,   ,      -
.       ,  ,
         ,   ,    
 .           
    getblk ( 3.4).

            getblk
     .

    1.      -,    -
       .
    2.       -,    -
           .
    3.       - ,   
           (   2),     
       ,    "   ".   -
               .
    4.       -,    -
        .
    5.     -,      
       .

        .

             
 ,   -,     . 
-,        ,  (  
)         .   -
      ,   ,   "-
"  ,    (**)     . 
      ,     -
       .   -
       ,    ,  -
      ,    .   3.5 
 ,     4  -,   "  0
  4".    ,       ,
  5  28   .


----------------------------------------

(**)    ,       -
      ,    .  ,  "-
      "   ,      .
           ,     -
        ,    ;   -
      "",      .

                                     43
    +------------------------------------------------------------------+
    |  getblk                                                  |
    |  :                |
    |  :  ,     |
    | {     (  )                             |
    |    {    (  -)                                 |
    |       {     ( )    /*  5 */                  |
    |          {                                                       |
    |             (  );             |
    |            ;    /*     */      |
    |          }                                                       |
    |            ;  /*  1 */                 |
    |               ;              |
    |           ;                                          |
    |       }                                                          |
    |             /*    - */        |
    |       {                                                          |
    |           (    ) /* 4*/      |
    |          {                                                       |
    |             (   );      |
    |            ;    /*     */      |
    |          }                                                       |
    |               ;              |
    |           (    )            |
    |                           /*  3 */                         |
    |          {                                                       |
    |                 ;      |
    |            ;    /*     */      |
    |          }                                                       |
    |          /*  2 --    */               |
    |              -;                    |
    |              -;                     |
    |           ;                                          |
    |       }                                                          |
    |    }                                                             |
    | }                                                                |
    +------------------------------------------------------------------+
                3.4.   

        -
         +-----------------+     +-----------------+
         |                 |     |+----+     +----+|    +----+
         |  0  4 |---- ++ 28 ++   ++  4 ++    | 64 |
         +-----------------+      +----+|   +------+    +----+
         |                 |      +----+|    +----+|    +----+
         |  1  4 |----  | 17 ||   ++  5 ++   ++ 97 ++
         |                 |      +----+|   |+----+  +-++----+|
         +-----------------+            +---|--------+ +------+
         |                 |      +----+    |+----+    |+----+
         |  2  4 |----  | 98 |+---+| 50 |    ++ 10 ++
         +-----------------+      +----+|    +----+     +----+|
         |                 |      +----+|    +----+     +----+|
         |  3  4 |----+>|  3 ++    | 35 |     | 99 ||
         +-----------------+    | +----+     +----+     +----+|
         +-----------------+    |                             |
         |  +----+                             |
         | |<---------------------------------+
         +-----------------+

                ()   4   -

                                     44



        -
         +-----------------+            +--------------+
         |                 |      +----+|    +----+    |+----+
         |  0  4 |---- ++ 28 ++    |  4 |    || 64 |
         |                 |     |+----+     +----+    |+----+
         +-----------------+     +-----------------+   |
         |                 |      +----+     +----+|   |+----+
         |  1  4 |----  | 17 |    ++  5 ++   ++ 97 ++
         |                 |      +----+    |+----+     +----+|
         +-----------------+                |          +------+
         |                 |      +----+    |+----+    |+----+
         |  2  4 |----  | 98 |+---+| 50 |    ++ 10 ++
         |                 |      +----+|    +----+     +----+|
         +-----------------+            |                     |
         |                 |      +----+|    +----+     +----+|
         |  3  4 |----+>|  3 ++    | 35 |     | 99 ||
         |                 |    | +----+     +----+     +----+|
         +-----------------+    |                             |
         +-----------------+    |                             |
         |  +----+                             |
         |                 |                                  |
         | |<---------------------------------+
         +-----------------+

           ()   4    

       3.5.   -  1:   -

    +------------------------------------------------------------+
    |  brelse                                            |
    |  :                    |
    |  :                            |
    | {                                                          |
    |            |
    |     ,     ;     |
    |            |
    |     ,     ;    |
    |        ,       |
    |       ;                          |
    |     (      )        |
    |                  |
    |                                            |
    |                 |
    |         ,    |
    |       ;                            |
    |     ();                                 |
    | }                                                          |
    +------------------------------------------------------------+

              3.6.   


     ,     , ,   
  ,     .      
              
    .      "";   -

                                     45

           ,   ,
      .   -
   ,        -
  brelse  ( 3.6).    , 
  - ,    ,       ,
      -  ,     
.   ,     ,    ,  
           ,
  ,  ,       
     (.  2.2.2.4).   -
     ,         
 -       "" - , 
    ;        .
      .
       brelse  ,      
,           ,
   -          (.  
3.4).       ,  -
           -
  ,        -
   brelse.       ,
      brelse   -
   getblk,     
          getblk.
        .
       getblk    2,     -
  -,       ,   -
  .           -,  -
    "" 

 -
  +-----------------+     +-----------------+
  |                 |     |+----+     +----+|    +----+
  |  0  4 |---- ++ 28 ++   ++  4 ++    | 64 |
  |                 |      +----+|   |+----+     +----+
  +-----------------+            |   +------+
  |                 |      +----+|    +----+|    +----+
  |  1  4 |----  | 17 ||   ++  5 ++   ++ 97 ++
  |                 |      +----+|   |+----+  +-++----+|
  +-----------------+            +---|--------+ +------+
  |                 |      +----+    |+----+    |+----+
  |  2  4 |----  | 98 |+---+| 50 |    ++ 10 ++
  |                 |      +----+|    +----+     +----+|
  +-----------------+            |                     |
  |                 |      +----+|    +----+     +----+|
  |  3  4 |----+>|  3 ++    | 35 |     | 99 ||
  |                 |    | +----+     +----+     +----+|
  +-----------------+    |                             |
  +-----------------+    |                             |
  |  +----+                             |
  |                 |                                  |
  | |<---------------------------------+
  +-----------------+

             ()   18 -   





                                     46
 -
  +-----------------+     +-----------------+
  |                 |     |+----+     +----+|    +----+
  |  0  4 |---- ++ 28 ++   ++  4 ++    | 64 |
  |                 |      +----+|   |+----+     +----+
  +-----------------+            |   +------+
  |                 |      +----+|    +----+|    +----+
  |  1  4 |----  | 17 || +->|  5 ++   ++ 97 ++
  |                 |      +----+| |  +----+  +-++----+|
  +-----------------+            +-|----------+ +------+
  |                 |      +----+  |  +----+    |+----+     +----+
  |  2  4 |----  | 98 |  |  | 50 |    ++ 10 ++    | 18 |
  |                 |      +----+  |  +----+     +----+|    +----+
  +-----------------+              |                   |
  |                 |              |  +----+     +----+|
  |  3  4 |----          |  | 35 |     | 99 ||
  +-----------------+              |  +----+     +----+|
  +-----------------+              |                   |
  |  +--------------+                   |
  | |<---------------------------------+
  +-----------------+

()       ,   18

             3.7.    

  ,  ,     .   
     ;      
      -.       
  ,    ,    --
,   ,         -
,    ,     -.
   ,   ,    
   .  ,      -
  ,             -
      .     
,     .   3.7,  -
,       18,      -,  
" 2  4".         -
 ( 3),    18          
-.
          getblk    3,   
      . ,  ,
          ,  
          .
            -
  .    ,    -
         .   
       .      
         ,  
 " "     ,   -
     ,   
   . ,      3.8,    
      18,       
( )    ,  ,     
  .     ,   -
         ,      ,
 4.        "  "
 " "   ,   " 18",   --
.

                                     47

        ( 3.9) ,    A,  
     -     -
         ,    2. , 
     ,    A    
  ,        brelse, -
 .    A,     -
  -    .      
    ,    ,   -
              
  ,      A.   -
,     ,     
  .   3.10    
   .
       ( 3.11)  ,    
     .  ,  
,      A,       ,
       .  -
,   A -
       ,    2,   -
       . ,  
    A ,    , B, 
    ,      
 A.  B ( 5)      --
.        ,    ,
          ,  B
   ""      ,
  A   .
         A    ,   .
  A ""  ,        "
  ",    B.      
  B,  B     ,   -

 -
  +-----------------+     +-----------------+
  |                 |     |+----+     +----+|    +----+
  |  0  4 |---- ++ 28 ++   ++  4 ++    | 64 |
  |                 |      +----+|   |+----+     +----+
  +-----------------+            |   +------+
  |                 |      +----+|    +----+|    +----+
  |  1  4 |----  | 17 ||  +-+  5 ++   ++ 97 ++
  |                 |      +----+|  | +----+  +-++----+|
  +-----------------+            +--|-+ +------+
  |                 |      +----+   | +----+    |+----+
  |  2  4 |----  | 98 |+--+ | 50 |    ++ 10 ++
  |                 |      +----+|    +----+     +----+|
  +-----------------+            |                     |
  |                 |      +----+|    +----+     +----+|
  |  3  4 |----+>|  3 ++    | 35 |     | 99 ||
  |                 |    | +----+     +----+     +----+|
  +-----------------+    |                     |
  +-----------------+    |                             |
  |  +----+                             |
  |                 |                                  |
  | |<---------------------------------+
  +-----------------+

    ()    18     
           


                                     48

 -
  +-----------------+
  |                 |      +----+                +----+
  |  0  4 |----+>| 28 +------------+   | 64 |
  |                 |    | +----+            |   +----+
  +-----------------+    |                   |
  |                 |    | +----+     +----+ |   +----+
  |  1  4 |----| | 17 |     |  5 | +-->| 97 ++
  |                 |    | +----+     +----+     +----+|
  +-----------------+    |                +------+
  |                 |    | +----+     +----+    |+----+     +----+
  |  2  4 |----| | 98 |     | 50 |    ++ 10 ++    | 18 |
  |                 |    | +----+     +----+     +----+|    +----+
  +-----------------+    |                             |
  |                 |    | +----+     +----+     +----+|
  |  3  4 |----| |  3 |     | 35 |     | 99 ||
  |                 |    | +----+     +----+     +----+|
  +-----------------+    |                       |
  +-----------------+    |                             |
  |  +----+                             |
  |                 |                                  |
  | |<---------------------------------+
  +-----------------+

    ()   3  5,   4   18

             3.8.    


     -
      +-----------------+
      |                 |      +----+     +----+     +----+
      |  0  4 |----  | 28 |     |  4 |     | 64 |
      |                 |      +----+     +----+     +----+
      +-----------------+
      |                 |      +----+     +----+     +----+
      |  1  4 |----  | 17 |     |  5 |     | 97 |
      |                 |      +----+     +----+     +----+
      +-----------------+
      |                 |      +----+     +----+     +----+
      |  2  4 |----  | 98 |     | 50 |     | 10 |
      |                 |      +----+     +----+     +----+
      +-----------------+
      |                 |      +----+     +----+     +----+
      |  3  4 |----  |  3 |     | 35 |     | 99 |
      |                 |      +----+     +----+     +----+
      +-----------------+
      +-----------------+
      |  +---------+
      |                 |         |
      | |<--------+
      +-----------------+

            18,    

           3.9.    


. ,   , C,     , 

                                     49

    C  B;     C  
      . ,  B
  ,    .
     B     ,     -
   ,   C    
  ,    2.    B  -
,         ,  -
  B     .      -
      ,   
   ,  -        
  .

                   A                 B
    +-------------------------------------------------------------
    |           b              -
    |            -                  -
    |                                          -
    |         -             -
    |                                   -
    |                                          -
    |                      -
    |                 -                   b
    |                 -                    -
    |                 -
    |                 -                 -
    |                 -                       
    |                 -
    |                 -                
    |                 -                         -
    |  +------------------------------------------------------+
    |  |    :  brelse |
    |  +------------------------------------------------------+
    |                 -                   
    |                 -                
    |                 -
    |                 -                  
    |                 -                       b
    |                 -
    v
    

            3.10.    


      ,  B   ,    -
      ,    2.   -
,    99  (  3.11),        
-,      .    -
  ,         -
.   3.12    .
         ;     "-
"         .  
  ,    ,   , -
  ,  ,      -
          -
   (***).     -

----------------------------------------
(***)     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.    


      ,    
 "" .       -
,     -    . 
 ,    ,      -
 ,       .   -
            
 ,     .  ,    -
,    ,    ,   
  .
        ,   ""  -
    .   , ,  
 ,   ,   -
,         ,     -
 .       , -
     ,   ,    
- ,        . -
,    ,      -
    ,          -
.



    ,       ,  -
        .   


                                     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     .




       ,   ,    -
 ,   ,  .
  *         -
      ,        --
    .   ,        ,  
    ,     ,   . 
    -      , 
       ,   -  , -
         .  ,   -
     .
  *           
     ,   -,    
          .   
            -  
        , ..     
        .     
               
    .            -
           
    ,  ,       -
     UNIX.         -
     ( ),       -
        ,    
       .
  *    ,    -
            . -
    ,     ,   -
              -  .
       " ",     -
       ,          
     . ,           
     .   ,  ,   
      ,    ,   -
    :       ,    
           ,     -
        .
  *        -
    ,         ,    
     ,   .     -
            ,   -

                                     55

      (, getblk)     -
    ,   .
  *          -
            ,
          .    
              -
    ,     ,     
      .          ,
      ,   :  -
    ,       ,   , 
            (****).
  *        -
            . ,
     ,            ;
    ,   ,    ,   
     .        -
             ,
            -
    ,      (  getblk  -
     )   ,      
         .




                 
,       .    -
   ,        -
  .          -
  ,       , -
,  
,     , ,    .
,          , -
    .   -
 ,  "  -  "    -
,      ,    
   .     -  
    ,    
     .
               
 .  getblk        ,
      ,     . 
 ,          
,    .   ,  -
         .    
,        ,   
.  bread         -
.  bwrite        
.         
      ,     "
",    -.  ,   -


---------------------------------------
(****)    -          
         fflush.     
               
       .       ,    -
         .

                                     56

    ,     ,  
     .         
 ,         
 ,    -.
            . -
           
    ,    -
, , ,        .  
    ,       -
.       , 
,    .  ,    -
   ,   ,   ,  
  .




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

Last-modified: Thu, 12 Feb 1998 07:18:41 GMT
: