10 - Storage Flashcards
Main components of file system
- Directory service
2. Storage service
Directory service : what
- Map file names => file identifiers
2. Handle access and existence control
Storage service : what
- Provide mechanism to store data on disk
2. Means to implement directory service
What is a file?
- Abstraction for non-volatile storage
- User abstraction ???
- Different types : data (numeric, character, binary), program (source, object, executable), documents.
- Typically comprises a single contiguous logical address space
Internal structure of file
Can be:
- None : simple sequence of words / bytes
- Simple record structure : lines, fixed length, variable length
- Complex internal structure : formatted document, relocatable object file.
Difference between text and binary
Text vs binary ??
- Sequence of lines, each terminated by a special character
- Explicit EOF character
Can map anything to a byte sequence by insertion of control characters, and interpretation in code.
Compare programmer / OS deciding control characters
- OS : may be easier for programmer but will lack flexibility (e.g. ?)
- Programmer : has to do more work (why?) but can evolve and develop format (how?).
State two ways of naming files
At least two kinds:
- System file ID (SFID)
- typically a unique integer value associated with a file, used within file system itself. - Human name
- e.g. hello.java, what users like to use - User file ID
- used to identify open files in applications
Purpose of the directory data structure [not directory service as a whole]
- Store mapping from human name to SFID
=> Provide means to translate (user) name to location of file on disk.
more purposes?
Storage of directories
- Directories are also non-volatile,
.: store on disk with files - Storage system sits “below” directory service (since storage system prerequisite to directory service).
Information contained in file metadata
What : any data about file excluding the contents of the file
EG
1.
File control block :
Directory resolves name to SFID, then need to map from SFID to FCB (file control block) – this mapping is file specific [diagram]
FCB:
- Contents, name(s)
Metadata
- Location : ptr to file location on device
- Size in bytes
- Time, date of creation,
- User / owner identification : data for access permissions, security and usage monitoring.
- Protection : controls who can read, write
- Type : e.g. file vs directory
Requirements of directory datastructure
=> Purpose: Provide means to translate (user) name to location of file on disk.
Requirements:
EFFICIENCY : locate physical location of file with user name quickly
NAMING : user convenience
- Allow two ( … N) users to have same name for different files.
- Allow one file to have several different names
GROUPING
- Logical grouping of files by properties, e.g. “all Java programs”.
Evaluate single level directory
What : one directory shared between all users
- Naming problem : why
- Grouping problem : why
Evaluate two level directory
One directory per user
- Access via pathname (e.g. bob : hello.java )
- Can have same filename for different user
- But still no grouping capability.
=> add a general hierarchy for more flexibility.