Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

file system and keeping track of free blocks

Posted on 2009-04-08
23
Medium Priority
?
353 Views
Last Modified: 2013-12-26
I just read from a book that we can use a linked list to keep track of free blocks, however I don't quite understand how it works.. can someone please help me to explain this?
0
Comment
Question by:kuntilanak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 11
23 Comments
 

Author Comment

by:kuntilanak
ID: 24104210
the part that I don't quite understand is that say that the size of each block is 1k and a block number is 32 bit.. so therefore I can represent 256 free block number in 1 block.. is this correct? or am I seeing this the wrong way?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24104274
You need to know that this is implementation specific since the block may contain other info that also takes space.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:kuntilanak
ID: 24104374
well.. for the sake of argument lets assume that the free block list reserves one byte for the pointer to the next block and everything else is for the block number..
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24105205
then, 1k block gives

1024 - 1 = 1023 bytes
1023 / 4 almost equal to 255
0
 

Author Comment

by:kuntilanak
ID: 24107332
ok if one block can list 255 free block numbers... this is where I got confused... how do they map these block number to the actual place on the disk?? is the disk also labelled with block number as well?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24112446
there is no need to label disk blocks it is a reference from partition begin
0
 

Author Comment

by:kuntilanak
ID: 24112943
is 255 actually the number of pointers?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24112994
yes, but these could be pointing to other blocks which in turn have the pointers to the file blocks depending on the file size
0
 

Author Comment

by:kuntilanak
ID: 24113178
depending on what file size
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24113677
the file that a user may create on the file system. Which book by the way are you reading from? There are many books that discuss file systems in general like the operating systems design book or specific file system implementations like unix / linux operating systems design.
0
 

Author Comment

by:kuntilanak
ID: 24113689
I am reading the normal tanenbaum book...
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24113692
very good book, I also studied from the same book :)
0
 

Author Comment

by:kuntilanak
ID: 24113699
so are they always assuming that pointers are 4 bytes here?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24113729
It depends on the implementation !
0
 

Author Comment

by:kuntilanak
ID: 24116043
I know.. in a 64 bit machine pointers can also not be 4 bytes.. but then why did you do this:
1023 / 4

1023 is the number of bytes right and 4 is the number of bytes per pointer
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24116108
As I understood from your question and later comments, the block size for the free blocks list is 1024 and that one byte is reserved for pointing to the next block, and that the pointer to the free block is 4 bytes in size, hence

(1024 - 1) / 4
0
 

Author Comment

by:kuntilanak
ID: 24116133
a block number is 32 bit... so that implies the pointer is 32 bit as well?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24116263
yes
0
 

Author Comment

by:kuntilanak
ID: 24116339
so a block number is not the same as the actual physical address of the disk? if it isn't then what's the size of the actual physical address of the disK?
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 2000 total points
ID: 24117343
see, when you partition a disk, you set in the partition table where the partition physically starts on the disk and its size. Then when you create a file system on it you reserve some blocks for i-nodes and rest for files data blocks. the references to blocks within this partition, is relative to the starting block of the partition. The disk driver will take care of the mapping between the relative block number and the physical block number.

One more difference I would like to highlight is that the disk blocks are 512 bytes (1 sector which is 512 bytes) and the file system block could be 1k , 2k, 4k, 8k, etc. hence you will not get one to one mapping
0
 

Author Comment

by:kuntilanak
ID: 24117528
hmmm...so therefore if I have 1K disk block then it is actually 2 sectors?? when you mean the relative block number, does this mean the 32 bit number that we're talking about...
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24117540
yes
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question