Solved

difference between word and byte

Posted on 2004-08-17
14
4,004 Views
Last Modified: 2008-01-09
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
Comment
Question by:decentswati
14 Comments
 
LVL 5

Expert Comment

by:AshuraKnight
ID: 11827780
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
 
LVL 55

Expert Comment

by:andyalder
ID: 11828389
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
 
LVL 2

Assisted Solution

by:catknows
catknows earned 125 total points
ID: 11831592
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
 
LVL 1

Author Comment

by:decentswati
ID: 11839671
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
 
LVL 2

Accepted Solution

by:
catknows earned 125 total points
ID: 11842393
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
 
LVL 2

Expert Comment

by:catknows
ID: 11842545
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
 
LVL 1

Author Comment

by:decentswati
ID: 11858291
Hello catknows,
that means we never save our memory space using bit operation in c.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:catknows
ID: 11859177
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
 
LVL 1

Author Comment

by:decentswati
ID: 11867099
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
 
LVL 2

Expert Comment

by:catknows
ID: 11867828
You got it! (-:
0
 
LVL 2

Expert Comment

by:Supercomputeruk
ID: 11872881
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
 
LVL 1

Author Comment

by:decentswati
ID: 11877565
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
 
LVL 2

Expert Comment

by:catknows
ID: 11878535
I am glad that helps and thanks for accepting the answer. Cheers.
0
 
LVL 1

Expert Comment

by:clivewakeham
ID: 12091351
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

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Join & Write a Comment

Sometimes the best way to deal with an infected computer is to boot from external media and run your tools from there.  The reason you may wish to do this really depends on the infection.  Some malware is so recalcitrant that no matter what you do i…
Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now