Page 1 of 9
where are the 1's and 0's?
Posted: Sat Oct 01, 2011 3:33 am
by bonch
I was told by a smarter person than me once that binary 0's and 1's are actually just a convenient abstraction for programmers to think in and that a CPU actually thinks in terms of binary states which are represented as high and low voltage levels. Is this universally true? Also, what about memory? Do memory sticks perceive 1's and 0's or voltage states or something else? Like if i cracked open a memory stick would I find bytes in there represented in binary 1's and 0's (assuming I didn't destroy the thing while I was cracking it open)?
Re: where are the 1's and 0's?
Posted: Sat Oct 01, 2011 4:06 am
by schilds
It's not so much for the convenience of programmers but for the convenience of electronic circuit designers. In any case, I wouldn't say computers "think" in binary any more than I would say that they think in voltages. They think using binary represented as voltages, but what actually they think in is logic (i.e. computations using those binary digits represented as voltages), which could be boolean, arithmetic, conditional, etc.
You can use any two different states of any physical property to represent binary. For example, two different voltages (electronic circuits - cpu/ram), alignments in magnetic field (hard drives), bumps and troughs in a material (compact discs/punch cards).
RAM doesn't necessarily have to be implemented using circuits but assuming it is, then if you could (non destructively) poke a (teeny weeny) voltmeter at each memory cell in RAM then you would "see" binary recorded in differing amounts of stored charge.
Re: where are the 1's and 0's?
Posted: Sat Oct 01, 2011 5:24 am
by Solar
1 and 0, yes and no, true and false, on and off, high pot and low, light or not. It doesn't matter; what matters is that there are exactly two states. Of course a CPU doesn't "think" in the arabic numbers 1 (a vertical line) and 0 (an elongated circle), but it does "think" in a binary way.
Re: where are the 1's and 0's?
Posted: Sat Oct 01, 2011 7:03 am
by Artlav
Solar wrote:what matters is that there are exactly two states.
Unless you have a Soviet balanced trinary computer.
Re: where are the 1's and 0's?
Posted: Sat Oct 01, 2011 7:25 am
by Chandra
I agree with Solar. Most people are in illusion of considering 'binary' only as a number system. In fact, it is just a notation of referring two different states. Not necessarily 'on' or 'off', but can be 'on' and 'not on' or whatever the underlying system is able to distinguish. And yes, unless under rare exceptional cases as Artlav mentioned, computers understand only binary as it is precise method of manipulating data.
Re: where are the 1's and 0's?
Posted: Sat Oct 01, 2011 9:53 am
by Venn
*Throws everyone off balance by mentioning tri-state electronics*
One could also say that a computer "thinking" is also an abstraction of passing voltages (or the lack thereof) over semiconductor pathways which produce a new or in some way altered new set of signals. But ja, at the most basic of all levels, electronics are really just based upon electrical signals (and/or the lack thereof). Which is quite important but not nearly as important as being able to have a user* measure these signals to produce new input or in some way utilize the signals in some useful way, otherwise it's just a useless collection of silicon and other various chemical elements.
*-a user can be anything from a human such as you and I or another electronic device.
Re: where are the 1's and 0's?
Posted: Sat Oct 01, 2011 7:01 pm
by NickJohnson
I think the issue is that "binary" usually means a base-2 encoding of a number. Computers are a bit more general: they deal with sequences of elements from a two-element set (i.e. {T, F}, {1, 0}, {on, off}, etc.) When you use bitwise operations or move things in and out of memory, you aren't actually interpreting anything in binary. However, we tend to still refer to everything as being "in binary", which is confusing if you try and make things very precise.
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 3:25 am
by bonch
It's confusing to me because I'm a very literal type of person. If someone tells me that all code compiles to 1's and 0's I want to know where the 1's and 0's are. For as long as I can remember I have been told that.
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 4:53 am
by Combuster
So you also believe that air shapes to the letter "a" when you speak?
0 and 1 are symbols for the two states. Code compiles to binary, which is represented to the user as the symbols 0 and 1 because we can't read electrons from paper.
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 8:46 am
by schilds
So you also believe that air shapes to the letter "a" when you speak?
Well, speech came before writing, so when you speak "a" the air does in fact carry exactly what a human directly recognises as "a". Also, you might imagine that a society that knows nothing of physics might postulate that speech somehow does involve the transmission of funny shaped, invisible objects through space.
:p
Also, it's probably not impossible to create a device that operates with tiny objects that physically resemble 1s and 0s. So someone (who otherwise knows nothing of computers), on their being told that a computer operates with 1s and 0s, why should you be surprised if they imagine a somewhat literal interpretation of that?
Anyway, the important thing is actually the transformation of information.
For example, when your vocal chords and mouth form a particular shape that represents "a", when you push air past them this causes a particular vibration in the air that represents "a", which causes vibrations in a microphone built out of the kind of material where electrons start moving around when it vibrates, giving off a pattern of continuous voltages/current representing "a" in an analog circuit, that pattern is passed into a cleverly arranged circuit that produces a corresponding set (representing "a") of discrete high and low voltages for each input voltage.
Now, if one doesn't know the transformation that occurs along the way, it's not surprising that one might ask questions like this or imagine things familiar to them.
Also, those 1s and 0s a computer uses don't even have to be used in any way shape or form that resembles the normal use of a 1 or 0. It's the operations using them that determines what they are. If you can perform arithmetic with them then they're numbers. If you perform boolean operations then they're boolean values. If you convert them into speech or text then they're words. Telling someone that they're 1s and 0s without specifying the operations that you perform with them is actually completely meaningless and downright misleading (in the same way as picking the wrong metaphor or analogy) :p.
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 1:01 pm
by AJ
Hi,
bonch wrote:It's confusing to me because I'm a very literal type of person. If someone tells me that all code compiles to 1's and 0's I want to know where the 1's and 0's are. For as long as I can remember I have been told that.
It looks from your other posts like you are developing an OS (or at least a boot loader). As you continue, you're going to find a lot of stuff based on abstraction. Even the high level stuff - look at how window managers use real world objects to represent concepts.
For anyone in to such things, I recommend the Terry Pratchett / Ian Stuart / Jack Cohen Science of Discworld books, which explains the concept of teaching as "lies to children", with ever more 'accurate' lies as you progress through education. They also tak about the relationship between sets of numbers and real world objects. Some here may find those books too basic, but I like them!
Cheers,
Adam
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 1:03 pm
by DavidCooper
bonch wrote:It's confusing to me because I'm a very literal type of person. If someone tells me that all code compiles to 1's and 0's I want to know where the 1's and 0's are. For as long as I can remember I have been told that.
There are a lot of people with Asberger's Syndrome who may be way above normal intelligence and yet can get confused when they run up against this kind of issue. They need to be told that the 1's and 0's are simply convenient names that we use to describe a variety of different physical realities used to hold information. With binary data storage systems there are always two states of something which could be given the names "state one" and "state two", though it's obviously more convenient to call them "state zero" and "state one" as it ties in better with the binary number system. Having come up with these names, we then simplify things by talking about "zeros" and "ones" instead of the more time-consuming "things in state zero" and "things in state one" every time, and that's where it gets difficult for people who take things literally. In the case of memory it is normal to use a voltage of about 5 volts running through a bit of memory as "state 1" while a voltage of 1.5 volts running through it would count as "state 0", but it would be perfectly possible to make a chip that uses the higher voltage as its "state 0" and the lower voltage as its "state 1" - all that matters is that it consistently uses one of the two states to represent a 1 and the other to represent a 0, and then the programmer can decide what the 1 or 0 in a specific place will represent in the way of meaning or function.
Most of the time in programming it isn't all about ones and zeros either, so it would be a mistake to think of everything in the machine as binary, even though everything is held in binary form. Often it feels more like using base 256 because whole bytes are mapped to different meanings and functions, so when you work directly with machine code instructions you soon begin to think of it this way, forgetting all about 0's and 1's and just thinking about the ideas that whole bytes (or pairs/groups of bytes) represent. The byte value itself can always be broken down into 8 bits, but the meaning or function which it maps to often cannot be broken down to anything smaller than the whole byte.
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 1:27 pm
by NickJohnson
@DavidCooper: you mean Asperger's syndrome?
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 8:29 pm
by schilds
Enough incoherent ranting from me :p.
My advice is to look up boolean logic/algebra and logic gates. That should help explain what someone means by saying computers think in 1s and 0s. The use of "1" and "0" is nothing more than just a naming convention. At (almost) the lowest level, computers are mostly constructed from devices (logic gates, constructed themselves from transistors) that operate with boolean logic. Unlike the names "1" and "0", saying that computers operate using boolean logic is (a) meaningful, (b)not merely some convenience or some abstraction. If a machine performs operations within boolean logic, then it's "thinking" in boolean logic, simple as that.
Then you might want to look at how a device (circuit) performing arithmetic can be constructed using boolean logic gates.
Re: where are the 1's and 0's?
Posted: Sun Oct 02, 2011 9:46 pm
by bonch
No it's not incoherent at all, I've learnt much. I do understand the difference between binary states and symbolic representations of them. I just wanted to make sure in my own obtusely literal mind that when 0's and 1's are mentioned they are always just symbols.
What I'm unsure of now is the "interface (possibly the wrong word)" between the symbols we use in programming and the binary states (voltages) understood by the processor. For example, when we program in assembly, we are dealing in symbols. These symbols, as I understand them, basically wrap operation codes into English sounding words and called "mnemonics". These operation codes still exist in the realm of symbols, right? As opposes to the processors language (electricity)? It must be a symbol because we can say 01 or AJMP, or 02 or LJMP (they are interchangeable/mean the same thing). But there is some phase of translation that translates these instructions from the symbols humans find useful (characters) into instructions the processor understands (binary electrical states). This is the phase I don't understand. It cannot be part of the processor because it doesn't understand characters, and it cannot be part of the program because a program is a collection of characters. Does that make sense?
@DavidCooper I'm checking out MSB-OS, I think this program might be perfect to help me visualise the CPU and memory better.
I'm interested that you say "and bear in mind that even assembler keeps a lot hidden from you". This is the area I'm trying to understand. I think at the moment that the "lowest level" for a programmer is opcodes so I figured it would be simple to have an interpreter that just passes the operation codes to the processor but assembling turned out to be much more complicated than that .. :p ... anyway I'm confusing myself. Can I convert MSB-OS_v3.img to .iso to run in virtual box? Wikipedia says:
Code: Select all
A CD or DVD image file, essentially equivalent to an ISO file. On such a file, simply changing the extension from IMG to ISO can make it usable as the latter by most programs.
so I tried that but virtual box says MSB-OS_v3.iso is non-bootable.