Kishan Kumar
Kishan Kumar

Reputation: 709

Why a word in memory always contains 2^n number of bytes?

I don't understand why a word always contains bytes in power of 2 . Why it can't contain 5 bytes or 6 bytes ?

Upvotes: 1

Views: 196

Answers (1)

Peter Camilleri
Peter Camilleri

Reputation: 1902

This has not always been the case. There have been machines in the past that have 12 bits (the PDP-8) 18 bits (the PDP-7) 36 bits (the PDP-10) or even 60 bits (the CDC 6600)

Even today there are machines with odd sizes. The PIC 16xxxx family by Microchip stores intructions in 14 bit words while the 24xxxx series uses 24 bit instructons. These are however, specialized, embedded chips, not general purpose machines.

For the most part though, things moved to powers of two. A big push for this was the old IBM 360 which introduced the now familiar (if somewhat dated) 32 bit word containing 4 eight bit bytes.

This combination of a power of two word size and a power of two number of bytes per word made addressing of both integers/pointers and characters simple and efficient.

Modern machines have simply updated this to 64 bit words with 8 eight bit bytes per word, retaining this useful advantage.

Upvotes: 2

Related Questions