Presentation is loading. Please wait.

Presentation is loading. Please wait.

File System – Unix baed. An entry of Active File table: 1. Access Right: r/w/x 2. Process Count: no. of processes which are now referring to the file.

Similar presentations


Presentation on theme: "File System – Unix baed. An entry of Active File table: 1. Access Right: r/w/x 2. Process Count: no. of processes which are now referring to the file."— Presentation transcript:

1 File System – Unix baed

2

3 An entry of Active File table: 1. Access Right: r/w/x 2. Process Count: no. of processes which are now referring to the file 3. Read Pointer/Write pointer: The starting points of next reading and writing, respectively. 4. Active i-node table entry: pointer to an active i-node …

4 An entry of Active i-node table: 1. Reference Count: no. of active file table entries that are pointing to this entry 2. Device address: address of an I/O device 3. Owner ID 4. Group ID 5. Last user who reads/writes: User ID of the user who perform the last read/write.

5 System call open(): 1. if U-ofile is full then return (-1) 2. if (“file name” is not in Active i-node table) read the directory entry from the i-node in disk according to “file name”; 3. if (“file name” does not exist in the i-node table in disk) return (-1); 4. check access right – user ID and –rwx rwx rwx; 5. if (access deny) then return (-1); 6. allocate a free Active i-node table entry (AITE);

6 7. copy directory data of underlying file to this entry; 8. allocate a free Active File table entry (AFTE); 9. copy directory data of underlying file to this entry; 10. allocate a free U-ofile entry (UOE) with the lowest fd in underlying user’s PCB; 11. connect the path UOE – AFTE – AITE;

7 system call write (): 1. access the AFTE according to fd specified by the user. fd is one of the arguments of the system call; 2. check the access right; 3. if (access deny) return (-1); 4. write the data specified in the buffer “buf” to the file according to write pointer recorded in the user’s corresponding AFTE;

8 system call read (): 1. access the AFTE according to fd specified by the user. fd is one of the arguments of the system call; 2. check the access right; 3. if (access deny) return (-1); 4. read the data pointed to by the user’s read pointer to the buffer “buf” specified in the arguments of the system call;

9 system call create (): 1. allocate a free current directory entry; 2. fill in some data, like file name, date, time, …; 3. write the directory entry back to disk; 4. system call open ();

10 system call close (fd): 1. follow the fd specified in the argument of this system call to access the corresponding AFTE from user’s U-ofile; 2. if ((process count--) == 0) {disconnect the connection between the AFTE and its AITE; if ((reference count--) == 0) store AITE back to i-node table in disk;}


Download ppt "File System – Unix baed. An entry of Active File table: 1. Access Right: r/w/x 2. Process Count: no. of processes which are now referring to the file."

Similar presentations


Ads by Google