Monday, February 18, 2008

Bits, Bytes, Megabytes and the rest

An interesting thread appeared on one of the T224 OUSA conferences today. The question came up about how many bits there are in a byte, and how many bytes make a word. Now, you might look at that and think '...thats easy, everyone knows how many...' but do they?

Curiously, only last night night I was think about a dialogue I had with some technical people at IBM around 1990. In that discussion I had queried their (IBM) term for MBytes. They were using the value of 10 to the 6th (1,000,000) and I had always used 2 to the 20th (1048576). The problem that I had was that there documentation said that I should format the paging areas (this is on an IBM Mainframe) in 1MB blocks - but they were using the wrong definition of a megabyte! Anyway, I argued my case and they agreed (IBM's phrase for such things used to be 'A non documented restriction' - in other words: 'oh right yeah, we didn't know it worked that way - and we haven't documented it - but thats how we say it works from now on....').

So, back to T224: The word from the OU is that there are always 8 bits in a byte. They didn't qualify that statement in any way. Now, I know for a fact that on some systems (1970's) there were 6 bits in a byte - I know that because I had to write some conversion software for them - so its NOT TRUE to say that there are always 8 bits in a byte. Mind you I can't imagine anyone now designing a processor that did't use 8 bits per byte - so its pretty unlikely that anyone need worry about that (unless, perhaps, you work at the Science Museum and are involved in conserving such machines).

Then the question went to how many bits there are in a word. Now, this is more complicated - because it all depends on the architecture of the processor, the bus size etc. On an 8-bit processor then word size would be 8-bits, on a 16-bit processor the word size would be 16 bits, 32 bits on a 32-bit processor, and so on. And even then its not so straight forwards. I seem to recall that on the Zilog Z80 chip (anyone remember CP/M?) you had an 8-bit processor with a 16-bit address bus - and, if I remember correctly, a 16-bit word size.

Anyone know what the word-size is on the 64-bit processors?

Blog Watch