Download presentation
Presentation is loading. Please wait.
Published byAntony Foster Modified over 9 years ago
1
1 File Processing : File Organization and File Systems 2015, Spring Pusan National University Ki-Joune Li
2
STEMPNU 2 Logical Structure of File File Field Record (Tuple) Record Block Fixed Size Record Variable Size Record
3
STEMPNU 3 Fixed Size Record Fixed Size Fixed Number of Fields, and Fixed Size of each Field Easy to implement Disk Address (n-1)*s record Deletion of a record Like Array but no movement Free Record List or Pointer to Next Record
4
STEMPNU 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
STEMPNU 5 Delimiters Record … … Delimiters Record … … Pointer/Size Difficult to handle deletions and insertions
6
STEMPNU 6 Slotted Page n 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. n 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. n Pointers should not point directly to record But to the entry for the record in header. n Pointers should not point directly to record But to the entry for the record in header. Pointer to Record
7
STEMPNU 7 Reserved Space Maximum # of Fields
8
STEMPNU 8 Overflow Area First field of record Rest records
9
STEMPNU 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 Name ID# Contiguous Reserved Block for BLOB
10
STEMPNU 10 File System Example fd=open(”data.txt”,O_RDONLY,0); Nbytes=read(fd,buf,100); How to process these functions in OS ?
11
STEMPNU 11 i (index)–node : information about file Attributes Pointers to data block i-node Data Block Name Permission Ownership Last updated date/time Created date/time Type : directory, data, special
12
STEMPNU 12 i-node : Pointer to data block Attributes Pointers to data block (0-9: up to 40K bytes) Pointers to data block (0-9: up to 40K bytes) Single direct Pointer Data Block... Data Block... Data Block Pointer Block (1024 blocks) Pointer Block (1024 blocks) Double direct Pointer
13
STEMPNU 13 Block configuration for i-node Boot Block Super Block 0 1 i-node 1 ~ 40 i-node 41 ~ 80 … … 2 3 Data block … … Reserved Block Given by formatting User space
14
STEMPNU 14 Implementation of File Hierarchy Attributes i-node 6 Attributes i-node 1 i-node for root directory i-node for /usr Attributes i-node 19 1 1 1 1 4 4 7 7 14 Root directory block 9 9 6 6 8 8.... bin dev lib etc usr tmp 6 6 1 1 19 30 54 Directory block for /usr.... lik kimmk parksh i-node for /usr/lik 19 6 6 107 Directory block for /usr/lik.... data.txt Data block for /usr/lik/data.txt Attributes i-node 107 i-node for /usr/lik/data.txt
15
STEMPNU 15 FAT (File Allocation Table) DOS or MS-Windows 98 Same purpose of i-node in UNIX
16
STEMPNU 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.