2
$\begingroup$

This is a pretty naive question, but I would like to better understand the basics of information storage on a computer. I am not concerned with the detail of how any one operating system achieves this.

I know there are different ways to identify which bits in memory make up a given file (on a given machine at a given time) as revealed in the difference between "Size" and "Size on disk" in the properties of a file. Windows File Explorer currently says one of my files has Size 14.0 KB (14,415 bytes) and Size on disk 16.0 KB (16,384 bytes) Each is correct but they measure somewhat different things.

Here are my two core questions: Is it fair to say that a 14,415 byte file can be interpreted as a binary number with roughly 115,320 binary digits (8 times 14,415)? And is it likely that the same file transferred to another machine would be placed in storage a little differently so that it would be a different binary number? Or is that just way off track?

I will not ask more now since comments may help me to clarify the question in ways I would not think of myself.

$\endgroup$
  • 1
    $\begingroup$ I'd answer "yes", with the caveat that such "number" might start with a lot of leading zeros. Would you say that binary "numbers" $10$ and $00010$ are different? I'd call them bitstrings, bit sequences, or even byte sequences, since you can't store exactly 13 bits in a file. $\endgroup$ – chi Dec 4 '17 at 16:04
  • 1
    $\begingroup$ In most systems, the data contents of a file is a byte-string, and the file also has some metadata such as name and various timestamps. You can interpret byte-strings in various ways, it's really up to you. How files are stored on disk depends on many other things, mainly the filesystem and the hardware itself. $\endgroup$ – Yuval Filmus Dec 4 '17 at 17:59
  • $\begingroup$ @YuvalFilmus Do you mean the byte-string part of the file will be identical on all machines? I could believe that but I do not know. I believe the physical location of the byte string will often be discontinuous and this is why defragmenting is important (though it is much more automated today than 20 years ago). $\endgroup$ – Colin McLarty Dec 4 '17 at 18:20
  • 1
    $\begingroup$ The byte-string is a logical entity. How it is stored physically is a completely different matter which should be (usually) transparent to the user. $\endgroup$ – Yuval Filmus Dec 4 '17 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.