Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4115
  • Last Modified:

difference between word and byte

Hi,
this is a small question comparatively the bigger ones of all of u.I am confused with the basics of words and byte.what is the subtle difference between them.again in byte addressing and word addressing how we address a bit.please help me.
thanks.
0
decentswati
Asked:
decentswati
2 Solutions
 
AshuraKnightCommented:
Word : In programming, the natural data size of a computer. The size of a word varies from one computer to another, depending on the CPU. For computers with a 16-bit CPU, a word is 16 bits (2 bytes). On large mainframes, a word can be as long as 64 bits (8 bytes).

Byte : Abbreviation for binary term, a unit of storage capable of holding a single character. On almost all modern computers, a byte is equal to 8 bits. Large amounts of memory are indicated in terms of kilobytes (1,024 bytes), megabytes (1,048,576 bytes), and gigabytes (1,073,741,824 bytes).

Taken from webopedia.com :)
0
 
andyalderSaggar makers bottom knockerCommented:
You can have 6 bit bytes or seven or nine as well as eight bit bytes, that's why the term octet was introdiced in networking to eliminate ambiguity in the number of bits in a byte. http://dictionary.reference.com/search?q=byte
0
 
catknowsCommented:
1. A byte is the smallest UNIT a computer can address.  Therefore, you cannot address a bit, see item (2). Note carefully also, that when we say a byte, that is a byte of data.

2. You must distinguish data and address before you get to byte and word.

 (a) Memory (dynamic RAM (SRAM) or just RAM) in computer counts number of bytes. (byte of data). My system have 256 Meg, that is, 256 mega bytes of data.
 (b) Memory count byte from 0 to N-1.  If my system have 20 bytes, the address of each byte is 0, 1, ..., 19.
 (c) Since each address can only address a byte and not a bit in the byte, in order to change the data in a bit, you must read the byte (given the address), and modify the bit in the byte, and rewrite that whole byte back to the same address.

3. Here is your answer to the meaning of a byte and word. Keep in mind again, the 2 key words: data and address before we go on.
 (a) Back then when earlier computer comes out, 8-bit data is not enough to count anything as it can only count up to 255 unsigned number.  Computer designer wants more data power.  At that time memory hardware was extremely precious, so they figure 16-bit data is plentyful.  You figure, well, if you want 16-bit, why not just use 2 bytes of data. In software, you have to keep track of 2 addresses.

 (b) The software guys got tired of that.  For every 2 byte integer (data), you need 2 variables (in hardware, 2 variables mean 2 addresses).  So, they want ONLY one variable for TWO bytes data.  To the hardware guy, this mean they want the ability to address a byte but skipping the next byte.  They got two choices,  either (1) forsake the 8-bit address and make it 16-bit address, so that every address count is 16-bit or (2) create a new INSTRUCTION that can address 16-bit, and at the same retain the ability to address 8-bit addresses.  And the second choice is what they did.

 (c) Now you get a byte, that is 8-bit.  They did not want to confuse the later 16-bit address as a byte, so they come up with a term called word.  So what byte and word really mean is that, a byte is an "8-bit data" given by a byte address, and a word is 16-bit data given by word address.  That is technical. In common sense, I think the reason the word "word" is used for 16-bit address is because when in common language, when you put together the letters, you get a word.  And a byte at that time can easily used to address 26 letters, and the name "word" natural means what it was meant to be.

In short the subtle meaning difference of byte and word lies on the computer hardware evolution when dealing with the memory architecture.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
decentswatiAuthor Commented:
Hi,
thanks to all.I understood the term byte and word.but second one is still there.

dear catknows,
as u said u can't address a bit seems to me typical.b'coz if u have done c programming we go for the bit level programming.that is if u don't want to store ur data in 8 bits u can fix them less than 8.then what is that.
see,In case if there is need to change 1 bit it changes whole byte in that case also it is accessing 1-1 bit.I am confused. please explain more. thanks in advance.
0
 
catknowsCommented:
Let me understand you clearly on your second question, "How we address a bit.". In this case you meant, how do we address a bit in c-programming, or another words, in software?

In the above comment, I explain to you "How we address a bit in the computer hardware?". Before I goes into how we address a byte in software, especially in c-programming, you must understand that in computer hardware architecture, a bit does not have an individual address but a group of 8 bits does, therefore, you can't (in hardware).  Once you have done enough research on computer hardware architecture and understand this point then we can discuss the addressing in software below.

All software compiler follows the hardware closely at the core level. But the fact that you can use bit-wise variable in c, (only when declared in a member in a structure, though), does not mean the hardware can address a bit.  When you change a bit, the compiler actually read the whole byte, manipulate the bit that you want to change while keeping the rest of the bits unchanged, then rewrites the whole byte.  When you declare a structure member, for example, that has say, five bit, the compiler actually takes the whole byte in memory.  To prove the point, if you do sizeof(your_structure), you should 1 byte, (not 1 and 1/8).  Now, if you declare another member that has three bits, the compiler will use the rest of the bits in that byte, and sizeof(structure) should still 1 byte.   In the software point of view, you are ADDRESSING a bit, yes it's true.  The compiler does the dirty work for you.

The use of the word "addressing" is meant for understanding hardware so that you program more efficiently in software, I would think.

Hope that help.
0
 
catknowsCommented:
Let me summary this:

In c-programming, how we address a bit?
+ declare bit wise variable inside a structure and change it values using manipulating operators on it
+ or declare a variable, and does bit-wise operation on it

In computer, how it addresses a bit?
+ It does not.
0
 
decentswatiAuthor Commented:
Hello catknows,
that means we never save our memory space using bit operation in c.
0
 
catknowsCommented:
That is incorrect.

The fact that C-compiler does the background work to provide the bit wise variable (inside structure) allows you to save a lot of program memory! (and stack memory, too)

Let me give you some examples to explain of both cases:

Examples:

(1)
structure big {
  unsigned char  roulette_color;   //red,black,green
  unsigned char  dice_outcome;  //1,2,3,4,5,6
} a_big;

sizeof( a_big ) is 2 bytes

(2)
structure small {
  unsigned roulette_color : 2 ; //2 bits are enough to account for 3 colors
  unsigned dice_outcome : 3 ; //3 bits enough to take care 6 possibilites.
} a_small;

sizeof( a_small ) is 1 byte even if you only use 5 bits.

Comparing (1) and (2) you can see that c-language allows you to save
one byte.  That is 50% saving with only 2 variables.


Cheers
0
 
decentswatiAuthor Commented:
Hello catknows,
that means u r saying we does bitwise operations but cpu reads a byte even if it has to change only a single bit.that is cpu performs some calculations in existing data and find the new one and then it writes to the byte.

ultimately reading one byte at a time.
0
 
catknowsCommented:
You got it! (-:
0
 
SupercomputerukCommented:
The main thing to remember in C#/++ is that you can read in a byte of data and use bitwise operators to extract the useful bit out of that byte, seeming as memory works in bytes not bits. making reading individual bits physically impossible, cue flag manipualation.
If i find an example of how to do this I will post it.
0
 
decentswatiAuthor Commented:
Hi,
thanks for helping me.because question is in two parts.therefore iam splitting the points between two answers going to one name catknows.
Thanks for explaining in detail.
0
 
catknowsCommented:
I am glad that helps and thanks for accepting the answer. Cheers.
0
 
clivewakehamCommented:
Just a quick note that while a megabyte is usually 1,048,576 bytes, some sneaky companies are using the term megabyte to equal         1,000,000 bytes. As regards to storage on hard disks etc.

Regards,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now