4

I'm not sure whether I'm asking on the right site, since all the other questions seem to be a lot more abstract and theoretical. If I should remove the question, please tell me.

Are all files on my computer an integer amount of bytes? That is, does every file on my computer consist of an amount of bits divisible by 8? Or are there files that are, for example, 300 bits (37 and a half byte), or 301 bits (37.625 bytes)?

Follow-up question: does this mean that every file can be 'read' using a program that reads ASCII encoded files? (Of course the output would be nonsense, but the program shouldn't notice any difficulties, right?)

Dasherman
  • 143
  • 3

1 Answers1

5

Yes, every file has an integer amount of bytes. In fact, most file systems deal with blocks or clusters of bytes. If cluster size is 64KB a file may claim to take up 250KB, but it will actually take 4 clusters or 256KB. This reduces the problem of fragmentaton (now fragments can only get so small, and there can only be so many of them) and the problem of addressing (how big do addresses need to be to access any byte in your 500GB drive? Now the addresses can be shorter by 16 bits).

Karolis JuodelÄ—
  • 3,697
  • 16
  • 18