Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Processing : File Organization and File Systems

Similar presentations


Presentation on theme: "File Processing : File Organization and File Systems"— Presentation transcript:

1 File Processing : File Organization and File Systems
2018, Spring Pusan National University Ki-Joune Li

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

3 Fixed Size Record Fixed Size Disk Address Deletion of a record
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 Difficult to handle deletions and insertions Delimiters
Record Record Record Record Record Record Delimiters Pointer/Size Difficult to handle deletions and insertions

6 Slotted Page Records can be moved around within a page
Pointer to Record 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 Reserved Space Maximum # of Fields

8 Overflow Area First field of record Rest records

9 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 Block size Contiguous Reserved Block for BLOB Name ID#

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 (index)–node : information about file
Attributes Pointers to data block i-node Data Block Name Type : directory, data, special Permission Ownership Last updated date/time Created date/time

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

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

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

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

16 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; open write


Download ppt "File Processing : File Organization and File Systems"

Similar presentations


Ads by Google