Wednesday, October 2, 2013

Unix Algo Part 1

Listed by Anu Varghese (M.Sc 2013)

In chapter 3 there are mainly 5 types of algorithm. The algorithms describe below.      
1. Buffer Allocation:- The algorithms for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool.      
2. releasing a buffer :- The kernel may read data from the disk to the buffer and manipulate it or write data to the buffer and possibly to the disk.      
3. Reading a Disk Block :- The disk driver notifies the disk controller hardware that it wants to read data, and the disk controller later transmits the data to the buffer.      
4. Block Read Ahead :- The kernel checks if the first block is in the cache and, if it is not there, invokes the disk driver to read that block.       
5. writing a disk block :- The kernel informs the disk driver that it has a buffer whose contents should be output , and the disk driver schedules the block for I/O.      
      
    In chapter 4 there are mainly 7 types of algorithms. The algorithms describe below.  
1. Allocation of In-Core Inodes :- The kernel maps the device number and inode number into a hash queue and searches the queue for the inode.      
2. Releasing an Inode:- When the kernel releases an inode , it decrements its in-core reference count.      
3. Conversion of Byte Offset to Block Number in File System:- It gives the algorithm bmap for converting a file byte offset into a physical disk block.      
4. Conversion of a Path Name to an Inode :- The kernel works internally with inodes rather than with path names, it converts the path names to inodes to access files.      
5. Assigning New Inodes:- Whenever the kernel assigns a disk inode, it decrements the free inode count recorded in the super block.      
6. Freeing Inode:- This algorithm much simpler after incrementing the total number of available inodes in the file system, the kernel checks the lock on the super block.      
7. Allocating Disk Block:- The algorithm free for freeing a block is the reverse of the one for allocating a block.      
      
    In chapter 5 there are mainly 12 types of algorithms. The algorithms describe below.  
1. Opening a File:- The kernel searches a parameter namei it checks permissions for opening the file after it finds the in-core inode and allocates an entry in the file table for the open file.      
2. Reading a File:- The algorithm read for reading a regular a regular file.      
3. Creating a File:- The create system call proceeds according to the same algorithm as the open system call.      
4. Making  New Node:-  This algorithm mknod for making a new node.      
5. Changing Current Directory:- This algorithm chdir changes the current directory of a process.      
6. Creation of Pipes:- The kernel assigns an inode for a pipe from a file system designated the pipe device using algorithm ialloc.      
7. Mounting a File System:- The kernel only allows processes owned by a superuser to mount or umount file systems.      
8. Revised Accessing an Inode:- For the case of crossing the mount point from the mounted-on file system to the mounted file system,consider the revised iget.      
9. Revised Parsing a File Name:- After finding the inode number for a path name component in a directory, the kernel checks if the inode number is the root inode of a file system.      
10. Unmounting a File System:- When unmounting a file system ,the kernel accesses the inode of the device to be unmounted , retrieves the device number for the special file.      
11. Linking Files:- The kernel first locates the inode for the source file using algorithm namei, increments its link count, updates the disk copy of the inode, and unlocks the inode.      
12. Unlinking a File:- The kernel first uses a variation of algorithm namei to find the file that it must unlink.      

No comments:

Post a Comment