• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bits and Bytes

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are there 8 bits in a byte?
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Conrado,
Welcome to the Ranch!

We have several forums at the ranch and this forum is specifically for JavaFX. As your question is related to Java in general I am moving this topic to the Java in General forum.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't give you the definitive answer, but i have a few thoughts on the subject.

Computers are binary creatures. "bit" actually means "binary digit". That gives you two values. Not terribly useful. Say you want to be able to store the western alphabet. you need some way to store at least 26 values. If you want to store upper and lower case, you need 52. Throw in digits and symbols, and you get up to about 100.

since each additional byte gives you twice as many values, you'd need at least 7 to get up to 128 values.

But seven seems like an odd (as in 'unusual') number. Eight is just one more, and happens to be...a power of two, which computers like. If you wanted to go to another power of 2, you'd need 16 bits, which seems like overkill (at least, it does for what computers could deal with back in the 50's and 60's when they were invented). I would think it would lead to a LOT of wasted memory - most of those bits would basically be unused. And remember, back in the 60s, memory could cost as much as $1 PER BYTE. Paying for unusable memory is not something anyone really wants to do.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Conrado Sanchez wrote:Why are there 8 bits in a byte?


Why not? 8 is a nice, small power of 2. It's distinctly possible that it wasn't 8 bits on some early computers, but they were probably defunct before you were born.

Winston
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can remember computers with 6 bits to a byte as late as the early 1970s.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Conrado Sanchez wrote:Why are there 8 bits in a byte?


See Byte on Wikipedia.

It has not always been the case that a byte was 8 bits on all computers. In the early days of computers, different models had bytes (or "words") of different sizes. Eventually 8 bits in a byte became a de-facto standard, and now almost all computers have 8 bits in a byte.
 
Rancher
Posts: 1044
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> In the early days of computers, different models had bytes (or "words") of different sizes.

Your humble narrator once worked on a system which had 36 bit machine words consisting of 4 bytes of, well, you guessed it, 9 bits.
I wrote programs in Fortran and I realized only later the bytes' consisting of 9 bits: it had no significance.


reply
    Bookmark Topic Watch Topic
  • New Topic