unix filesystem question

  1. The problem statement, all variables and given/known data:
    The file system unix use a multilevel indexes access to disk, 12 direct blocks, 1 single indirect block, 1 double indirect block, 1 triple indirect block:
    Assuming a:
    block = 512 bytes,
    pointer = 4 byte,
    and there is a file of 200 blocks,
    how many disk access is needed to read the block number 13 with direct disk access?
    And how many disk access is needed to read this file sequentially form first block to 150?

  2. Relevant commands, code, scripts, algorithms:
    none

  3. The attempts at a solution (include all code and scripts):
    I think that is needed 1 disk access to read the block 13 and 150 disk accesses to read the file sequentially.

  4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    Universi� degli studi di Salerno, Salerno(Italy), Adele Rescigno, www.dia.unisa.it/professori/rescigno/SO/lo.htm

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

i can not answer this for sure BUT with only 12 direct blocks you can not reach block 13 with just one disk access. and the same is true for 150 blocks, even if they are sequential.

DukeNuke2 the block 13 is in the single indirect block, so it contain pointer that point to the data block, this is why i answered 1 disk access.

you have to access the inode for the data = one access, next is the inderect block = one access, after that the data in the inderect block = one access.

as i said, i don't know it for sure but i would vote for 3 disk accesses.

1 Like

Is the question based upon a hypothetical file system, or one of the many file system types available.
The people who write file system software generally have two goals in mind, one to reduce the average number of physical reads per request, and two to maintain the integrity of the data.
Some systems read each index block sequentially, others use a binary search.
Unless the question is based upon a specific lecture, I think that there are as many (real world) answers as there are file system types.