Wednesday 26 February 2014

Filesystem blocks

BLOCKS
File system is divided in to 5 blocks
1.boot block
2.super block
3.dentry
4.inode
5.data block

  • Boot block-located in first few sectors of a file system. first sector contains a boot strap program that reads a larger boot strap program from the next few sectors, and forth.
  • Each file system has one super block.it contains type of file system,the block size,pointers to a list of free blocks,the inode number of the root directory,magic number.
  • Every file  have one inode.In linux every file is recognized with integer number known as inode number.this structure consists of file ownership indication,file type(e.g., regular,directory,special device, pipes, etc.),file access permissions,time of last access and modification,number of links to the file,pointers to the data blocks to the file,size of the file in bytes.
       inode include pointers to the data blocks. Each inode contains 15 pointers.

  1.  the first 12 pointers point directly to data blocks
  2.  the 13 th pointer point to an indirect block, a block containing pointers to data blocks.
  3.  the 14 th pointer points to a doubly-indirect block, a block containing 128 addresses of singly indirect blocks.
  4. the 15 th pointer points to a triply indirect block(which contains pointers to doubly indirect blocks,etc)
      Difference Between in-core inode and disk inode:
                                               The inode is a data structure that descibes everything about a file other than their name.when a file is opened then the kernel copies the inode in to memory. As the file changes, the in-core inode is updated usuallymore often than on-disk copy. And the in-core inode has a few extra fields that are only needed while the file is opened.
                               In-core copy of the inode contains
                              -status of the in-core inode(ref)
                              -logical device number of file system(from which this inode is copied in to main memory)
                               -inode number
                               -pointers to other in-core inodes(hash list,queue list(ref, buffer cache))
                              -reference count(how many instances active at particular time)
   NOTE:By observing in-core copy of inode and disk inode, we observe that
            -we won't need inode number in disk inode because blocks are stored sequentially.But when we are transferring in to main memory that sequence may not be maintained.(ex., we may want node 4 followed by node12 and so on..)                                              
    REF:
    status-  1.locked(the inode may be used by some other process, to prevent other inode to access)
                2.A process is waiting for inode to be unlocked
                3.changed(if inode on memory is changed, this option helps to reflect the changes on disk)
                4.file changed(corresponding to this inode)
                      The above provided information is not found on disk.

Wednesday 12 February 2014

lot of forest land is to be cleared for the creation of seemandhra capital

AP Govt Proposals: 3 Locations for Seemandhra Capital | Capital for seemandhra

1)  Nallamala Forest Area between Vinukonda-Markapuram:

Plus Points: Railway line between Vijayawada and Bangalore, National Highway to Bangalore, Water from Srisailam project and Gundlakamma river. Most importantly, this place is close to both Andhra and Rayalseema.

Sunday 9 February 2014

deadlock

Deadlock is a situation where two or more processes waiting for an event to complete, but all processes wait for indefinite time.
       we have to 
  •  characterize the deadlock    
  •  prevent the deadlock
  • detect and avoid the deadlock
  • recovery from deadlock
  For that there are algorithms to provide execution softly

Saturday 8 February 2014

synchronization

                             synchronization is mechanism refers to the orderly execution of processes so that it can ensure that only one process executing in critical section(mutual exclusion).it is implemented in kernel mode.
note: critical section:
Here critical section refers to the memory shared by two or more processes.
ex:
Consider two processes increment and decrement. These two processes perform operations on common variable counter which is stored in memory.
We can divide the counter++ process in to few atomic operations.
                                 register1=counter             //value of counter loaded to register from memory
                                 register1=register1+1        //value is incremented by one
                                 counter=register1             //again updated value is stored in memory
 same way counter-- can be divided as
                                 register2=counter
                                 register2=register2-1
                                 counter=register2
  Above three atomic in two processes must execute in order to have good result.
  Let counter=9
                If we execute increment and decrement processes sequentially, the result is same 9.
  But if we allow to access these two processes to manipulate counter  in which the atomic operations presented  previously interleaved in some arbitrary order.one such interleaving is
      T0:    increment       execute      register1=counter              {register1=9}
      T1:    increment       execute      register1=counter+1          {register1=10}
      T2:    decrement      execute      register2=counter              {register2=9}
      T3:    decrement      execute      register2=counter-1           {register1=8}
      T4:    increment       execute      counter=register1              {register1=10}
      T5:    decrement      execute      counter=register2              {register1=8}
     We come across three possible solutions after executing the sequence.
     1) Above sequence will result  8.
     2) If we reverse the order of execution of T4 and T5, the result is 10.
     3) If two processes executer sequentially, the result is 9.
      Above three possibility results in race condition.
       To avoid race condition ,we should follow some algorithms that will result in sequential execution of each process.