Files & File System
September 18, 2016
Categorised in: Operating System Design
UNIX file system
- File is remarkable feature of UNIX
- File is a sequence of bytes of data that reside in semi permanent form on some stable medium
- Network interface, disk drive, keyboard, printer, etc are treated as file
- File management is flexible and powerful
- Provides hierarchical directory scheme
Internal Representation of File
- Each file in UNIX is specified by an unique inode
- Contains info. for a process to access a file
- Fields of an inode:
- File owner identifier
- File type
- File access permissions
- File access times
- Number of links to the file
- Table of contents for the disk addresses of data in a file
- File size
- User File Descriptor Table, File Table, Inode Table
File Data Structures
Algorithms
- Allocation of In-Core Inodes: iget
- Releasing an Inode : iput
- Conversion of a Path Name to an Inode: namei
Race Condition in assigning inodes
- Kernel assigns inode I to Process A
- Process A sleeps before reading disk copy into memory
- Process B wants an inode. It searches for free inodes, finds I is free, puts I on free list.
- Process A wakes up, initializes I and use it
- When process C requires inode, it gets I, but I is already initialized by Process A
Types of file
- Simple/ordinary file
- Directory file
- Link file
- Special file (Device file)
UNIX file system structure
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.