31436 Systems Software - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

31436 Systems Software

Description:

What is the difference between a file and a directory on UNIX? ... 12 direct pointers = 96 kilobytes. Single indirect pointer = 16 megabytes ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 21
Provided by: danielco
Category:

less

Transcript and Presenter's Notes

Title: 31436 Systems Software


1
31436 Systems Software NetworksAUTUMN 2002
  • Tutorial 8
  • File Management

2
QUESTION 1
  • What is the difference between a file and a
    directory on UNIX?
  • Would you expect the file access functions to
    work on directories?

3
UNIX Files and Directories
  • Both types are essentially streams of bytes.
  • UNIX administers files and directories alike by
    their iNodes.
  • But where a file can contain any type of data,
    directories only contain ltfilename inodegt entries
    a list of files.
  • No direct read/write operations can be performed
    on directories use mkdir and rmdir instead.

4
QUESTION 2
  • Some systems provide file sharing by allowing
    several users to access a single copy of the file
    simultaneously. Other systems provide multiple
    copies of the files. Discuss the advantages and
    disadvantages of each approach.

5
Single Copy of a File
  • Updates to the file can be viewed instantly by
    everybody.
  • Relatively simple to queue up all requests to
    write to the file.
  • But increases demand for network bandwidth.
  • Must be careful with file access permissions
  • No redundancy if file gets corrupted.
  • Saves disk space.

6
Multiple Copies of a File
  • Editing and updating the file is quicker, as each
    user has their own local copy.
  • Eases network load
  • Provides some redundancy in case one copy of the
    file becomes corrupted.
  • Becomes very difficult to maintain file
    consistency several versions of the same file
    are on separate workstations.
  • Waste of disk space.

7
QUESTION 3
  • What are the relative merits and drawbacks of
    each of these disk block allocation methods?
  • Contiguous
  • Chained
  • Indexed

8
Contiguous Allocation
  • Good performance from using sequential disk
    blocks.
  • Easy to randomly retrieve a single block.
  • Can be difficult sometimes to allocate contiguous
    blocks can result in external fragmentation.
  • Pre-allocation demands file size declaration at
    the time of creation.
  • Disk blocks can vary in size.
  • One entry required in file allocation table.

9
Chained Allocation
  • Poor performance is disk blocks arent close.
  • No adherence to principle of locality.
  • Difficult to randomly retrieve a single block.
  • Easy to allocate disk blocks one at a time. No
    external fragmentation possible now.
  • Suited to sequential files processed
    sequentially.
  • No pre-allocation no worries!
  • One entry required in file allocation table.
  • Fixed-size disk blocks.
  • Very difficult to reconstruct a file if one or
    more of its pointers has become corrupted.

10
Indexed Allocation
  • Easy to allocate disk blocks one at a time. No
    external fragmentation possible now.
  • File index is on leading block for that file.
  • File index block is very vulnerable!
  • Easy to randomly retrieve a single block.

11
QUESTION 4
  • Consider a UNIX file system. Assume that there
    are 12 direct block pointers, and a singly, a
    doubly, and a triply indirect pointer in iNode.
    Further, assume that the system block size is
    8KB. If the disk block pointer is 32 bits, with 8
    bits to identify the physical disk and 24 bits to
    identify the physical block, then
  • What is the maximum file size supported by this
    system?
  • What is the maximum file system partition
    supported by this system?
  • Assuming no information other that the file iNode
    is already in main memory, how many disk accesses
    are required to access the byte in position
    13,423,956?

12
iNodes
  • The iNode in this example includes 60 bytes of
    address information that is organized as 15
    32-bit (4-byte) addresses, or pointers.
  • The first 12 addresses are direct pointers.
  • The 13th address is a single indirect pointer.
  • The 14th address is a double indirect pointer.
  • The 15th address is a triple indirect pointer.

13
Direct Pointers
  • Direct pointers point straight to the first n
    blocks of the file.
  • 12 direct pointers point to the first 12 blocks.
  • Direct Pointer 0 Block 0 8KB
  • Direct Pointer 1 Block 1 8KB
  • Direct Pointer 11 Block 11 8KB
  • TOTAL 96KB

14
Single Indirect Pointers
  • System block size 8KB 8192 Bytes
  • Block Pointer 32 bits (32/8) Bytes 4 Bytes
  • Block OF Pointers 8192/4 2048 pointers per
    block
  • SID Pointer SID Block Block 0 8KB
  • Block 1 8KB
  • Block 2047 8KB
  • TOTAL 16,384KB
  • 16MB

15
Double Indirect Pointers
  • 2048 pointers
  • DID Pointer DID Block SID Block 0 Block 0 8KB
  • Block 2047 8KB
  • SID Block 2047 Block 4192255 8KB
  • Block 4194303 8KB
  • TOTAL 33,554,432KB
  • 32,768MB
  • 32GB

16
Triple Indirect Pointers
  • 2048 pointers 2048 pointers
  • TID Pointer TID Block DID Block 0 SID
    Block 0 Block 0 8KB
  • Block 2047 8KB
  • SID Block 2047 Block 4192255 8KB
  • Block 4194303 8KB
  • DID Block 2047 SID Block 4192255 Block
    8585738239 8KB
  • Block 8585740287 8KB
  • SID Block 4194303 Block 8589932543 8KB
  • Block 8589934591 8KB
  • TOTAL 68,719,476,736KB
  • 64TB

17
Maximum File Size
  • Add up maximum supported size of all components
    of the iNode.
  • 12 direct pointers 96 kilobytes
  • Single indirect pointer 16 megabytes
  • Double indirect pointer 32 gigabytes
  • Triple indirect pointer 64 terabytes
  • 96KB 16MB 32GB 64TB

18
Maximum Partition Size
  • oi

19
Disk Accesses
  • We want byte no. 13,423,956 ? 13,109KB.
  • The iNode is already in memory.
  • Thus the 15 pointers contained in this iNode are
    already in memory and doesnt require a disk
    access.
  • First 12 direct pointers cover first 96KB.
  • The first single indirect pointer then covers the
    next 16,384KB which covers KB no. 13,109.
  • So two access are required first access is the
    first SID, the second access is the block itself.

20
Need help? Ask me! )
  • Daniel COMARMOND
  • E-Mail dacomarm_at_it.uts.edu.au
  • ICQ 6606132
  • Phone 0421-036-986
  • Website http//charlie.it.uts.edu.au/dacomarm
  • THE SECRET WORD
  • Username www
  • Password rosebud
Write a Comment
User Comments (0)
About PowerShow.com