1 Laboratory work in TDDI04 Pintos Assignment 5
Viacheslav Izosimov 2009-04-23 viaiz@ida.liu.se
Lab 5::General Description
Lab 5: “File System” Synchronization of read-write operations
One writer writes at a time Many readers can read
Additional system calls to work with files
seek() tell() filesize() remove()
Creating and removing files without destroying the file system
Lab 5::General Description
Lab 5: “File System” Synchronization of read-write operations
One writer writes at a time Many readers can read
Additional system calls to work with files
seek() tell() filesize() remove()
Creating and removing files without destroying the file system
Lab 5::Files (1)
filesys/file.[h|c] - operations on files. A file object represents an open file. filesys/filesys.[h|c] - operations on the file system. filesys/directory.[h|c] - operations on directories. filesys/inode.[h|c] - the most important part of the implementation related to the file
- system. An inode object represents an
individual file (e.g. several open files fd1, fd2, fd3 may belong to one inode “student.txt”).
Lab 5::Files (2)
filesys/free-map.[h|c] - implementation of the map used to keep track of all free and occupied disk sectors. Important that no two files can allocate the same sector. devices/disk.[h|c] - implementation of the low-level access to the disk-drive.
Lab 5::Pintos file-structures
P1 P3 P2
STDIN STDOUT 2 3 4 struct file { … } STDIN STDOUT 3 STDIN STDOUT 2 5 struct file { … } struct file { … } struct file { … } struct file { … } struct file { … } 561 876 785 667 struct inode { … } struct inode { … } struct inode { … }
Open files Open inodes Disk location Free map Directory
struct inode { … } pfs pfs_reader pfs_writer