Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Overview Assignment 12: hints  Distributed file systems Assignment 11: solution  File systems.

Similar presentations


Presentation on theme: "1 Overview Assignment 12: hints  Distributed file systems Assignment 11: solution  File systems."— Presentation transcript:

1 1 Overview Assignment 12: hints  Distributed file systems Assignment 11: solution  File systems

2 2 A12 – Network File System (Sun) Virtual file system layer System call layer Local operating system NFS client Message to server Virtual file system layer Local operating system NFS server Message from client

3 3 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

4 4 A12 – Andrew File System (CMU) Virtual file system layer System call layer Local operating system AFS client Message to server Virtual file system layer Local operating system AFS server Message from client AFS cache

5 5 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

6 6 Server B A12 Ex1 – Moving a shared volume Client Server A

7 7 A12 Ex2 – Simultaneous accesses Client open modify close Server Client open modify close

8 8 A12 Ex3 – Immutable Files Files can only be created and read.  What is simplified?  What can be avoided?

9 9 Overview Assignment 12: hints  Distributed file systems Assignment 11: solution  File systems

10 10 A11 Ex1 – Max File Length data blocks inode direct 0 direct 1 direct 2 direct 3 direct 4 direct 5 direct 6 direct 7 direct … direct 11 single indirect double indirect triple indirect

11 11 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

12 12 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

13 13 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)

14 14 A11 Ex3 – I/O redirection / Pipes 0stdin 1stdout 2stderr 3 4 …… count 2, wr user file descriptor file table cnt 2 (/dev/tty1) inode table count 1 rd cnt 1 (file) $ command < file fd = open(file) close(stdin) dup2(stdin,fd) close(fd) exec(command) count 1, rd count 2, rd cnt 1 (/dev/tty1)

15 15 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)

16 16 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


Download ppt "1 Overview Assignment 12: hints  Distributed file systems Assignment 11: solution  File systems."

Similar presentations


Ads by Google