1 / 27

File Systems II

File Systems II. CS423, Fall 2007 Klara Nahrstedt/Sam King. Administrative. MP3 Deadline, November 5, 2007 Today’s Lecture Topics: Windows 2000/NT File System Linux/BSD/UNIX File System. Structure of Windows 2000 (simplified). Windows 2000 Architecture. HAL (Hardware Abstraction Layer)

neal
Download Presentation

File Systems II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. File Systems II CS423, Fall 2007 Klara Nahrstedt/Sam King

  2. Administrative • MP3 Deadline, November 5, 2007 • Today’s Lecture Topics: • Windows 2000/NT File System • Linux/BSD/UNIX File System

  3. Structure of Windows 2000 (simplified)

  4. Windows 2000 Architecture • HAL (Hardware Abstraction Layer) • HAL calls to associate interrupt service procedures with interrupts, and set their priorities, but does little less in this area • Kernel • Provides a higher-level abstraction of the hardware • Provides complete mechanisms for doing context switches • Includes code for thread scheduling • Provides low-level support for two classes of objects (Control objects and Dispatcher objects)

  5. Windows 2000 NTFS • Hierarchical file system (similar to UNIX) • Hard and symbolic links are supported • Highly complex and sophisticated FS • Different from MS-DOS FS

  6. Fundamental Concepts • NFTS file – not just a linear sequence of bytes • File – consists of multiple streams • Multiple attributes, each represented by a stream of bytes • Each stream has its own name foo:stream1; • Idea of multiple streams in a file – Apple Macintosh • What would be a good example that would utilize this idea of streams?

  7. Principal Win32 APIs for File I/O

  8. Open File Issues • To create and open a file, one must use CreateFile • There is no FileOpen API • CreateFile system call has 7 parameters • Pointerto the name of the file to create or open • Flags telling whether the file can be read, written, or both • Flags telling whether multiple processes can open the file at once • A pointer to the security descriptor • Flags telling what to do if the file exists/does not exist • Flags dealing with attributes such as archiving, compression,; • Handle of a file whose attributes should be cloned for the new file • Example: • Inhandle=CreateFile(“data”, GENERIC_READ,0,NULL,OPEN_EXISTING, 0, NULL)

  9. NFTS Structure • NTFS is divided into volumes • Each NTFS includes files, directories, other data structures • Each volume is organized as a linear sequence of blocks (block size between 512 and 4KB) • Main data structure in each volume is Master File Table (MFT) • What information does MFT includes? • Bitmap keeps track which MFT entries are free

  10. MFT for NTFS Organization • Boot-block has information • about the first block of MFT

  11. MFT Record (Example for 3-Run, 9-Block File)

  12. File Name Lookup How is CreateFile(“C:\maria\web.html”,…) executed?

  13. Steps in Looking UP file C:\maria\web.htm

  14. UNIX I/O System in BSD

  15. UNIX File System • UNIX File – a sequence of 0 or more bytes containing arbitrary information • Meaning of the bits is entirely up to the file’s owner • File Names • up to 255 characters (BSD, System V,…) • Base name + extension • How would you specify files?

  16. Important Directories in most UNIX Systems

  17. Locking Property • Multiple processes may use the same file at the same time – may lead to race conditions • Solution 1: program application with critical regions • What are the issues with this solution? • Solution 2: POSIX provides a flexible and fine-grained mechanism for processes to lock as little as possible • How would you implement this solution and what are the issues within this solution?

  18. Overlap of Locked Regions A file with one lock Addition of a second lock Third lock

  19. File System Calls

  20. Directory System Calls

  21. Implementation of UNIX FS • i-node carries metadata/attributes for exactly one file, 64 bytes long • i-node table • a kernel structure that holds all i-nodes for currently open files and directories • Open file operation- system reads the directory, comparing names until finds the name • If the file is present the system extracts i-node, uses this as an index into the i-node table • i-node table entry – device the file is on; i-node number, file mode, file size, etc.

  22. Looking up absolute path name • How would you look up the absolute path name /usr/ast/file? • How many i-nodes do you need to get and read? • What is the advantage to use relative path name?

  23. UNIX/LINUX Issues • Links • support of hard links and soft/symbolic links • Name two differences between hard links and symbolic links • UNIX also supports character and block special files • Example: • /dev/tty reads from keyboard • /dev/hd1 – reads and writes raw disk partitions without regard to the file system • Raw block devices are used for paging and swapping

  24. Relation between fd, open file table and i-node table

  25. Layout of Linux Ext2 File System • When a file grows, Ext2 tries to put it into the same block group as its directory

  26. Linux /proc file system • For every process in the system, a directory is created in /proc • The name of the directory is the process PID expressed as a decimal number (e.g., /proc/619 is the directory for process PID 619) • In this directory are files that appear to contain information about the process (e.g., command line, environment strings, signal masks) • Many Linux extensions relate to other files and directories located in /proc

  27. Questions • A UNIX i-node has 10 disk addresses for data blocks, as well as the addresses for single, double, and triple indirect blocks. If each of these holds 256 disk addresses, what is the size of the largest file that can be handled, assuming that a disk block is 1KB? • 10+256+511+766 • 10+256+511+65,536 • 10+256+65,536+16,777,216 • None of the above • In a UNIX file-system the block size has been set to 4K. Given that the i-node blocks are already allocated on disk how many free blocks need to be found to store a file of size 64K? • 16, or 17, or 64 or 65

More Related