If digital data is stored in 0s & 1s, how does the reader know how many of the digits to take into consideration?

930 views

Must be a very basic and dumb question. But ‘1001’ can be 9 and also 2 & 1 if ’10’ & ’01’ is taken seperately. I’m confused.

In: 49

48 Answers

Anonymous 0 Comments

It’s divided up, and any remaining space is filled with zeroes.

You may have heard the terms “bit,” “byte,” “megabyte,” etc. A bit is one digit; a byte is 8 digits, and multiples of that are named with their SI prefixes (“kilobyte”, “gigabyte”, etc).

So when the computer reads, it’s reading in multiples of 8 digits. In your case, the computer might read one byte that has the binary data “1001” stored in it. To the computer, this would show up as “00001001”, but 2 would just be “00000010” and 1 would be “00000001.”

Note that I’m talking about bytes for simplicity, but computers generally run off a “word” size (which is itself some multiple of 8 bits), and sometimes the first digit is flipped to 1 even if the data doesn’t fill the whole space. You can ignore that for now, that’s not important for this answer. Specifics aside, the point is that the computer is reading specific numbers of digits at a time and the data is padded with 0s if it doesn’t fill all of the digits the computer’s reading.

Anonymous 0 Comments

At the absolute lowest level, it’s built into the architecture of the system – when we say a “32-bit” or “64-bit” processor or architecture, what we are saying is that the native instruction set is encoded in that number of bits, with a bit being a discrete 1 or 0 – in other data sets that don’t need that much, we will have code that defines the length of a piece of data.

Anonymous 0 Comments

At the absolute lowest level, it’s built into the architecture of the system – when we say a “32-bit” or “64-bit” processor or architecture, what we are saying is that the native instruction set is encoded in that number of bits, with a bit being a discrete 1 or 0 – in other data sets that don’t need that much, we will have code that defines the length of a piece of data.

Anonymous 0 Comments

Short Answer: There is an index.

Long Answer: The index is in a fixed location on the disk so the drive knows where to look for it every time. Then for variable width files (images, video, music, text docs) the index gives starting/stopping locations around the disk as files are rarely contiguous these days, especially since SSDs came out. The disk then knows how to translate the start/stops/inbetweens to exact (positions on platters, locations on chip) where the 0/1’s are stored to then stream the file as requested.

Anonymous 0 Comments

Not dumb, a great question.

On the microprocessor level the hardware is designed to always read a certain number of digits, called “bits” in this case, and 4 bits become a “nibble”, 8 bits are a “byte”.

So a 16 bit microprocessor would read the value “one” as

0000 0000 0000 0001

and read “ten” as

0000 0000 0000 1010

So in older days, the processor size was a big deal, I played a lot of video games so I remember that the Nintendo was 8-bit, we then 16-bit systems (Sega and Super Nintendo). and then 32/64 bit processors with Nintendo 64, etc.

For the most part we’ve stuck at 64 bit for our processors for many reasons.

Anonymous 0 Comments

Not dumb, a great question.

On the microprocessor level the hardware is designed to always read a certain number of digits, called “bits” in this case, and 4 bits become a “nibble”, 8 bits are a “byte”.

So a 16 bit microprocessor would read the value “one” as

0000 0000 0000 0001

and read “ten” as

0000 0000 0000 1010

So in older days, the processor size was a big deal, I played a lot of video games so I remember that the Nintendo was 8-bit, we then 16-bit systems (Sega and Super Nintendo). and then 32/64 bit processors with Nintendo 64, etc.

For the most part we’ve stuck at 64 bit for our processors for many reasons.

Anonymous 0 Comments

Short Answer: There is an index.

Long Answer: The index is in a fixed location on the disk so the drive knows where to look for it every time. Then for variable width files (images, video, music, text docs) the index gives starting/stopping locations around the disk as files are rarely contiguous these days, especially since SSDs came out. The disk then knows how to translate the start/stops/inbetweens to exact (positions on platters, locations on chip) where the 0/1’s are stored to then stream the file as requested.

Anonymous 0 Comments

You need to know the type of data you are dealing with. For example, if you want to open a .wav file, you find the specification (https://ccrma.stanford.edu/courses/422-winter-2014/projects/WaveFormat/) and then you write your program to the specification.

It says first 4 bytes are the ID, then next 4 bytes are the size, then next 4 are the format… etc. etc. etc.

If somebody just hands you a blob of data and tells you to interpret it, then you are correct to be confused. You’d have no idea what the bytes mean.

Also, if you open a file in the wrong program, it interprets the bytes in the wrong way and you just get nonsense. Open a .exe file in notepad and it’s just crazy characters all over the screen.

Anonymous 0 Comments

Short Answer: There is an index.

Long Answer: The index is in a fixed location on the disk so the drive knows where to look for it every time. Then for variable width files (images, video, music, text docs) the index gives starting/stopping locations around the disk as files are rarely contiguous these days, especially since SSDs came out. The disk then knows how to translate the start/stops/inbetweens to exact (positions on platters, locations on chip) where the 0/1’s are stored to then stream the file as requested.

Anonymous 0 Comments

You need to know the type of data you are dealing with. For example, if you want to open a .wav file, you find the specification (https://ccrma.stanford.edu/courses/422-winter-2014/projects/WaveFormat/) and then you write your program to the specification.

It says first 4 bytes are the ID, then next 4 bytes are the size, then next 4 are the format… etc. etc. etc.

If somebody just hands you a blob of data and tells you to interpret it, then you are correct to be confused. You’d have no idea what the bytes mean.

Also, if you open a file in the wrong program, it interprets the bytes in the wrong way and you just get nonsense. Open a .exe file in notepad and it’s just crazy characters all over the screen.