How the Processor deals with the bits operation ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
green1
Posts: 5
Joined: Fri Apr 18, 2014 5:29 am

How the Processor deals with the bits operation ?

Post 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
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: How the Processor deals with the bits operation ?

Post 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.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: How the Processor deals with the bits operation ?

Post 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.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Post Reply