160 likes | 279 Views
Overview. Assignment 12: hints Distributed file systems Assignment 11: solution File systems. A12 – Network File System (Sun). System call layer. Virtual file system layer. Virtual file system layer. Local operating system. NFS client. NFS server. Local operating system. Message
E N D
Overview • Assignment 12: hints • Distributed file systems • Assignment 11: solution • File systems
A12 – Network File System (Sun) System call layer Virtual file system layer Virtual file system layer Local operating system NFS client NFS server Local operating system Message to server Message from client
A12 – NFS • Mounting protocol: • The server exports certain directories to certain machines (IP authentication) • The clients mounts a given directory from a specified server. • Directory and file access: • System calls are performed as remote procedure calls. • No open and close: stateless. • Security: • IP based (export lists) • UNIX permissions based on UID/GID
A12 – Andrew File System (CMU) System call layer Virtual file system layer Virtual file system layer Local operating system AFS client AFS server Local operating system AFS cache Message to server Message from client
A12 – AFS • Mounting • The server has no information about the clients. • Cell list maintained. • The client mounts the whole AFS tree (the whole AFS world). • Directory and file access • The file is cached locally and committed on close. • Security: • Kerberos server • Access list for files access
A12 Ex1 – Moving a shared volume Server A Server B Client
A12 Ex2 – Simultaneous accesses Server • Client • open • modify • close • Client • open • modify • close
A12 Ex3 – Immutable Files • Files can only be created and read. • What is simplified? • What can be avoided?
Overview • Assignment 12: hints • Distributed file systems • Assignment 11: solution • File systems
A11 Ex1 – Max File Length datablocks inode
A11 Ex1 – Maximal File Length Given: • block size = 2KB • address = 4 bytes (assumption) • table of contents = 15 entries (12 / 1 / 1 / 1) • number of entries in index table = 2048 / 4 = 512
A11 Ex2 – File Access ./a/b/c/f, File length is 1GB Directory access 2 disk acc. (1 for the inode, 1 for table) • 7 accesses until the file inode is known Positioning at the end of the file (2K blocks): • direct access: 24 KB • single indirect access: 1 MB • double indirect access: 512 MB • must use triple indirect access 4 accesses (1i+3t) Read the block and rewrite it with the additional byte 2 accesses Total: 13 disk accesses
A11 Ex3 – I/O redirection / Pipes $ command < file After shell fork() in the child process: • fd = open(file) • close(stdin) • dup2(stdin,fd) • close(fd) • exec(command)
A11 Ex3 – I/O redirection / Pipes user file descriptor file table inode table count 1, rd cnt 1 (/dev/tty1) $ command < file fd = open(file) close(stdin) dup2(stdin,fd) close(fd) exec(command) cnt 1 (file) count 1 rd count 2, rd
A11 Ex3 – I/O redirection / Pipes $ command1 | command2 Shell fork() pipe(fd[]) fork() close(stdout) dup2(stdout,fd[1]) close(fd[1]) exec(command1) close(stdin) dup2(stdin,fd[0]) close(fd[0]) exec(command2)
A11 Ex4 – Mounting Bach Book: Each file system type has a method table To access a file, indirect function call through the table • need FS abstraction, common to all FS • struct file_operation • read, write, readdir, ioctl, open, flush, release, fsync, lock • associate every file with its FS (method table) • inode has a pointer to file_operation