1 / 16

File Processing : File Organization and File Systems

File Processing : File Organization and File Systems. 2011, Spring Pusan National University Ki-Joune Li. Fixed Size Record. Variable Size Record. Logical Structure of File. File. Field. Field. Field. Record (Tuple). Record. Record. Block. Fixed Size Record. Fixed Size

krikor
Download Presentation

File Processing : File Organization and File Systems

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 Processing : File Organization and File Systems 2011, Spring Pusan National University Ki-Joune Li

  2. Fixed Size Record Variable Size Record Logical Structure of File File Field Field Field Record (Tuple) Record Record Block

  3. Fixed Size Record • Fixed Size • Fixed Number of Fields, and • Fixed Size of each Field • Easy to implement • Disk Address • (n-1)*srecord • Deletion of a record • Like Array but no movement • Free Record List or • Pointer to Next Record

  4. Variable Length Record • Variable Length due to • Variable Number of Fields, or • Variable Size of each Field • Complicated to implement • Implementation • Delimiter (, size, or pointer) • Slotted Page • Fixed Length • Overflow Area • Reserved Space

  5. Delimiters Pointer/Size Delimiters Record Record … Record Record Record … Record • Difficult to handle deletions and insertions

  6. Pointer to Record Slotted Page • Records can be moved around within a page • to keep them contiguous with no empty space between them • entry in the header must be updated. • Pointers should not point directly to record • But to the entry for the record in header.

  7. Maximum # of Fields Reserved Space

  8. First field of record Rest records Overflow Area

  9. Block size Name ID# Contiguous Reserved Block for BLOB Binary Large Object Block (BLOB) • If size (field) > size (block) • e.g. Image or Video • BLOB : Type of field where its size is greater than block size • cf. CLOB : Text rather than binary Name ID# Photo

  10. File System • Example fd=open(”data.txt”,O_RDONLY,0); Nbytes=read(fd,buf,100);  How to process these functions in OS ?

  11. i-node Attributes Data Block Pointers to data block i (index)–node : information about file Name Type : directory, data, special Permission Ownership Last updated date/time Created date/time

  12. Data Block . . . Data Block Data Block Pointer Block (1024 blocks) . . . Data Block i-node : Pointer to data block Attributes Pointers to data block (0-9: up to 40K bytes) Single direct Pointer Double direct Pointer

  13. 2 i-node 1 ~ 40 Given by formatting i-node 41 ~ 80 3 … Data block Data block … Data block Block configuration for i-node 0 Boot Block Reserved Block 1 Super Block User space

  14. Directory block for /usr i-node 19 i-node 1 Root directoryblock i-node 6 Attributes Attributes Attributes 6 . 1 . 1 .. 1 .. 19 lik 4 bin 30 kimmk 7 dev 54 parksh 14 lib 9 etc 6 usr Directory block for /usr/lik 8 tmp i-node 107 19 . Attributes Data block for /usr/lik/data.txt 6 .. 107 data.txt i-node for /usr/lik/data.txt Implementation of File Hierarchy i-node for root directory i-node for /usr i-node for /usr/lik

  15. FAT (File Allocation Table) • DOS or MS-Windows 98 • Same purpose of i-node in UNIX

  16. open write fd=open(”data.txt”,O_RDONLY,0);Nbytes=read(fd,buf,100); • Step 1 : Find i-node for “data.txt” via i-node • from root or current directory • Step 2 : Check owner and access right • Step 3 : Register it to OpenFileTable • Initialize entry values : e.g. offset, mode • fd : array index of this table • Some entries : reserved for stdio, stderr, etc.. • Step 4 : Check ownership and right • Step 5 : Read 100 bytes to buf • Read 100 bytes from the OpenFileTable[fd].offset • OpenFileTable[fd].offset += 100;

More Related