16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction to kernel<br />

Desirable Features<br />

! efficiency<br />

response time resource utilization<br />

throughput<br />

! reliability<br />

<strong>OS</strong> should be error free<br />

able to handle all contingencies<br />

! maintainability<br />

modular in construction<br />

clearly defined interfaces<br />

well documented<br />

! small size<br />

memory space<br />

large systems more prone to error<br />

Architecture of UNIX <strong>OS</strong><br />

File System<br />

! Ordinary Files<br />

It is not possible to insert bytes into <strong>the</strong> middle of a file, or delete bytes from <strong>the</strong> middle<br />

- editor for example<br />

- just write a completely new file<br />

concurrent access - file locking - semaphores<br />

i-number is an index into an array of inodes kept at <strong>the</strong> file system<br />

! Directories<br />

Inconvenient to refer to files by i-numbers, directories provide names to be used<br />

two column table, name & i-number-pair is called a link<br />

usr/ast/data usr ---> i-number to usr directory<br />

relative path OR absolute path begins <strong>with</strong> /<br />

when link count is zero <strong>the</strong> kernel discards <strong>the</strong> file<br />

directory entry: 14 bytes for file, 2 bytes for inode-number<br />

/usr ==> /usr/ast ==> /usr/ast/data<br />

! Special Files<br />

some type of device: tty, disk, FIFO<br />

block & character devices<br />

kernel pool of buffers - are used to cache to speed up I/O<br />

disks are both char & block special files<br />

special files have an i-node, no data bytes just a device number and index to device drivers<br />

! I-node<br />

When file opens <strong>the</strong> inode is kept in memory.<br />

1, file type 9 rwx protection bits + few o<strong>the</strong>r bits<br />

2, number of links<br />

3, owner id<br />

4, group id<br />

5, file size in bytes<br />

6, 13 disk addresses<br />

7, time file last read<br />

8, time file last written<br />

9, time i-node last changed<br />

13, disk addresses<br />

largest file = 1G byte for 512 byte blocks<br />

10 disk addresses ==> direct blocks of 512 bytes<br />

11 ==> indirect - points to 128 addresses<br />

- points to data blocks<br />

12 ==> double indirect - points to 128 addresses<br />

- points to 128 addresses<br />

- points to data blocks<br />

13 ==> triple indirect - points to 128 addresses<br />

- points to 128 addresses<br />

- points to 128 addresses<br />

- points to data blocks<br />

81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!