File organization文件的逻辑组织 Comparison of sequential and indexed sequential顺序文件与索引顺序文件的比较 Example: a file contains 1 million records On average 500,00 accesses are required to find a record in a sequential file If an index contains 1000 entries. it will take on average 500 accesses to find the key, followed by 500 accesses in the main file. Now on average it is 1000 accesses
File Organization文件的逻辑组织 Comparison of sequential and indexed sequential顺序文件与索引顺序文件的比较 – Example: a file contains 1 million records – On average 500,00 accesses are required to find a record in a sequential file – If an index contains 1000 entries, it will take on average 500 accesses to find the key, followed by 500 accesses in the main file. Now on average it is 1000 accesses
File organization文件的逻辑组织 4、 Indexed file(索引文件) uses multiple indexes for different key fields 为不同的关键字域建立索引 may contain an exhaustive index that contains one entry for every record in the main file(穷举索引:所有记录对应一索引项) may contain a partialindex(部分索引) Exhaustive Exhaustive Ind
File Organization文件的逻辑组织 4、Indexed File(索引文件) – uses multiple indexes for different key fields 为不同的关键字域建立索引 – may contain an exhaustive index that contains one entry for every record in the main file(穷举索引:所有记录对应一索引项) – may contain a partial index(部分索引) Exhaustive Index Exhaustive Index Partial Index
File organization文件的逻辑组织 5、 The direct, or hashed,File(直接文件) directly access a block at a known address key field required for each record Key 关键字 Hash function Primary File 哈希函数 主文件 Overflow File 溢出文件
File Organization文件的逻辑组织 5、The Direct, or Hashed, File(直接文件) – directly access a block at a known address – key field required for each record f Key 关键字 Hash Function 哈希函数 Primary File 主文件 Overflow File 溢出文件
File Organization文件的逻辑组织 6、分区文件 压缩文件,ip,rar 函数库lb Part A Part B Part C 索引区 Part A 文件区 Part C Part B
File Organization文件的逻辑组织 6、分区文件 – 压缩文件.zip .rar – 函数库.lib Part A Part B Part C Part A Part B 索引区 Part C 文件区
File directories文件目录 Contains information about files包含文件的信息 attributes文件属性 location存储位置 ownership所有者关系 Directory itself is a file owned by the operating system 目录本身是操作系统拥有的一个文件 Provides mapping between file names and the files themselves提供文件名与文件内容间的映射关系 FCB文件控制块
File Directories文件目录 Contains information about files 包含文件的信息 – attributes 文件属性 – location 存储位置 – ownership 所有者关系 Directory itself is a file owned by the operating system 目录本身是操作系统拥有的一个文件 Provides mapping between file names and the files themselves提供文件名与文件内容间的映射关系 FCB文件控制块