Skip to content

Instantly share code, notes, and snippets.

@freemedom
Last active January 9, 2023 06:19
Show Gist options
  • Save freemedom/1ddf49d1f04e83690b4f1e8927367d77 to your computer and use it in GitHub Desktop.
Save freemedom/1ddf49d1f04e83690b4f1e8927367d77 to your computer and use it in GitHub Desktop.
Comments on a StackOverflow answer

I think some parts of this answer are not easy to understand, so I added some explanations.

The meaning of this answer is
physical block in the question >> should be logical block
logical block in the question >> should be virtual block


If the first (or zeroth) logical block of the file is Z, then the mapping from any virtual block to logical block N is N-Z.

0
1
2
...
Z --- 0
Z+1 --- 1
... --- ...
N-1 --- N-Z-1
N --- N-Z

The left side is the logical block number and the right side is the virtual block number.


Y + 1 is the displacement into the last physical block.

Y + 1
"+ 1" means that "pointer to next block" is in front and "511 bytes of data" is behind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment