Operating Systems Design and Implementation Chapter 05 (version January 30, 2008 ) Melanie Rieback Vrije Universiteit Amsterdam, Faculty of Sciences Dept. Computer Science Room R4.23. Tel: (020) 598 7874 E-mail: melanie@cs.vu.nl, URL: www.cs.vu.nl/ ∼ melanie/ 01 Introduction 02 Processes 03 Input/Output 04 Memory Management 05 File Systems 00 – 1 /
File Systems • Files • Directories • File system implementation • Security • MINIX file system 05 – 1 File Systems/
File systems Basic model: a file is just an abstract storage device with the following operations: type FILE ID is INT create(id: out FILE ID) delete(id: in FILE ID) open(id: in FILE ID) close(id: in FILE ID) read(f: in FILE ID, pos: in INT, data: out BYTE) write(f: in FILE ID, pos: in INT, data: in BYTE) Idea: the operating system returns a unique file iden- tifier when a file is created. This file id is used on all subsequent operations. Variations: • Only support sequential files: (1) reads can only be done starting at the head of the file, (2) writes imply appending data to the file. • Support structured files by providing records in- stead of bytes, which might further be organized as a tree. 05 – 2 File Systems/5.1 Files
File Organization Observation: Despite that many files are byte-oriented and unstructured from the OS point of view, internally, things may be quite different: Module� name Magic number Header Text size Data size Date Header BSS size Object� Owner Symbol table size module Protection Entry point Size Flags Header Text Object� module Data Header Relocation� bits Object� module Symbol� table (a) (b) 05 – 3 File Systems/5.1 Files
Recommend
More recommend