Page 1 of 1

How the Processor deals with the bits operation ?

Posted: Sat Dec 06, 2014 11:56 am
by green1
Hi,

I am currently studying OS from "OS Internals and Design Principals". In the topic of Memory Management I just encounter a paragraph in which it is mentioned that while doing paging in case of virtual memory, there are some additional control bits are involved, in which each bit has its own meaning. In processor hardware there are registers that basically deals with the 8 bit 16 bit etc. I am little bit confused that how micro-prcessor deals with individual bits. How the bit wise operation is done. Another example is each file has attributes and bits in the attributes basically defines that whether that the file can be read/write. How processor instruction can perform bit operations. Please your kind help is required to clear this confusion. Thanks

Re: How the Processor deals with the bits operation ?

Posted: Sat Dec 06, 2014 12:05 pm
by iansjack
It depends upon the processor. Some have instructions to manipulate individual bits. If not, (almost) all processors support logical instructions that allow you to alter individual bits by using suitable masks with AND and OR instructions.

Read the reference manual for the particular processor you are targetting.

Re: How the Processor deals with the bits operation ?

Posted: Sat Dec 06, 2014 7:12 pm
by SpyderTL
The truth is that all CPUs only understand bits. All of the instructions that they execute affect the bits, individually. Each logical operation either compares bits together, or turns the bits "on" or "off".

It just so happens that when you group these bits together in groups of 8 or 16 or 32, etc. that these operations can perform simple math (or complex math in some cases). But you have to keep in mind that these bits can be interpreted in different ways. The same bit values can simultaneously represent numbers, letters, and "on/off" switches. It just depends on how you look at it.

You may see letters on the screen, or hexadecimal values in memory, but all the CPU sees are ones and zeros. You just have to keep that in mind when you are trying to communicate with the CPU.