The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search attributes in one structure using the values from another structure dhanamurthy High Level Programming 3 03-27-2008 12:37 AM
file structure yoavbe Shell Programming and Scripting 7 10-16-2007 03:27 AM
using regular expressions in c shell control structure ballazrus Shell Programming and Scripting 3 02-19-2006 09:59 PM
TAR only the file structure Andysundar UNIX for Dummies Questions & Answers 1 10-13-2005 01:06 PM
Copying a Directory Structure to a new structure jhansrod UNIX for Dummies Questions & Answers 8 07-27-2005 03:24 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 12-12-2001
Registered User
 

Join Date: Dec 2001
Location: India
Posts: 7
structure of regular file

hi,

I am reading 'the design of the unix os' by Bach and I find the 'regular file structure' details with the 'direct and indirect blocks of the inode' difficult to understand.

Thanks
__________________
R Ramya
Forum Sponsor
  #2  
Old 12-13-2001
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,619
I dug out my copy of Bach last night and reviewed chapter 4, "Internal Representations of Files". My copy of Bach is from 1986, you may have a newer version. My copy is describing Ken Thompson's original unix filesystem. This filesystem was a commercial failure and I doubt if it is still used anywhere. Section 4.1.2 "Accessing Inodes" describes how all the inodes are together. This caused massive arm movement because the heads had to repeatedly access the inode list at the start of the disk.

Marshall McKusick wrote a much better filesystem which he called the Berkeley Fast File System. It really conquered the commercial world. HP-UX calls it hfs and SunOS calls it vfs. It has large blocks, cylinder groups, distributed inodes, bitmaps of free blocks rather than a single free list, blocks/fragments, long filenames and symbolic links. If your copy of Bach is not describing this filesystem, you may be confusing yourself. In this case, I would suggest switching to a more modern book.

But the block pointers in an inode have not changed very much. My book's figure 4.6 is similiar to the diagram on this page. Let's say that your file had the following 15 data blocks assigned to it: 4096, 228, 45423, 11111, 101, 367, 428, 9156, 824, 747, 4351, 171, 987, 654, and 594. For the first ten block numbers it's easy, they go in slots 0 though 9. But what do we do with the other 5 block numbers? We get another data block, let's assume that we get block 908. We take block 908 and write the numbers 4351, 171, 987, 654, and 594 in it. Then we put 908 in the single indirect slot. When we read the file, we just read the first 10 blocks from the numbers in the inode. The we see that 908 is our single indirect block so we read it. It has the the list of the final five blocks.

I hope this has helped.
  #3  
Old 12-14-2001
Registered User
 

Join Date: Dec 2001
Location: India
Posts: 7
Wink

Hi,

Thanks a lot I have a reprint of the same 1986 version.This book is the standard book that all follow over here.Too bad that we are following an outdated book.

I referred to the link you gave me and went through all the lecture pages. It really helped me to get things clear.
__________________
R Ramya
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0