Warum verwenden Computer das Binärzahlensystem (0,1)? Warum verwenden sie stattdessen kein ternäres Zahlensystem (0,1,2) oder ein anderes Zahlensystem?
Warum verwenden Computer das Binärzahlensystem (0,1)? Warum verwenden sie stattdessen kein ternäres Zahlensystem (0,1,2) oder ein anderes Zahlensystem?
Antworten:
Da wir in der Informatik sind, antworte ich so: Sie tun es nicht.
Was meinen wir mit einem "Computer"? Es gibt viele Definitionen, aber in der Informatik als Wissenschaft ist die Turing-Maschine die gebräuchlichste.
Eine Turingmaschine wird durch mehrere Aspekte definiert: eine Statusmenge, eine Übergangstabelle, eine Stoppmenge und ein für unsere Diskussion wichtiges Alphabet. Dieses Alphabet bezieht sich auf die Symbole, die das Gerät als Eingabe lesen und auf das Band schreiben kann. (Sie könnten verschiedene Eingabe- und Bandalphabete haben, aber lassen Sie uns diesbezüglich keine Sorgen machen.)
Ich kann also eine Turing-Maschine mit dem eingegebenen Alphabet oder oder, or . It doesn't matter. The fact is, I can use any alphabet I choose to encode data.
So, I can say that is 9, or I can say that is 9. It doesn't matter, since they're just symbols we can distinguish.
The trick is that binary is enough. Any sequence of bits can be interpreted as a number, so you can convert from binary to any other system and back.
But, it turns out unary is enough too. You can encode 9 as 111111111. This isn't particularly efficient, but it has the same computational power.
Things get even crazier when you look into alternate models of computation, like the Lambda calculus. Here, you can view numbers as functions. In fact, you can view everything as functions. Things are encoded not as bits, 0s and 1s, but as closed mathematical functions with no mutable state. See the Church numerals for how you can do numbers this way.
The point is that, 0s and 1s is a completely hardware specific issue, and the choice is arbitrary. What encoding you're using isn't particularly relevant to computer science, outside of a few subfields like operating systems or networking.
Some other things to consider:
Part of the reason for using a binary number system is that it's the lowest-base number system that can represent numbers in logarithmic, rather than linear, space. To uniquely distinguish between different numbers in unary, the average length of representations must be proportional to at least , since there is only one string of length where ; . To uniquely distinguish between different numbers in binary, the average length of representations must be proportional to at least , since there are binary numbers of length ; . Choosing a larger base improves on the space requirement by a constant factor; base 10 gets you numbers with an average representation length of , which is times the average length of a base two representation for all . The difference between binary and unary is much greater; in fact, it's a function of . You get a lot by choosing binary over unary; you get much less by choosing a higher base, by comparison.
There is some truth to the idea that it's easier to implement digital logic if we only have to distinguish two states. Electric signals are analog and, as such, can be interpreted to represent as many discrete states as you'd like... but you need more precise (hence expensive and finicky) hardware to reliably distinguish more states over the same range. This suggests choosing as low a base as you can.
Another potentially important consideration is that logic has classically been understood to involve two distinct values: and . Now, we have fancier logics than this, but a lot of mathematics and science still rests on pretty foundational notions. When you consider that computers are used to compute, and that logic is important for computation, it suggests having good support for at least two distinct states... but logic doesn't really require more than that.
One of the big reasons that most computer circuits use two states is that the quantity of circuitry necessary to distinguish between n different voltage levels is roughly proportional to n-1. Consequently, having three discernible states would require twice as much circuitry per signal, and having four would require three times as much. Tripling the amount of circuitry while only doubling the amount of information would represent a loss in efficiency.
Note that there are some places in computers where information is stored or communicated using more than two states per element. In a flash memory array, hundreds or thousands of memory cells may be serviced by one set of level-sensing circuitry. Using four levels per cell rather than two when storing a certain amount of information might more than triple the size of the level-sensing circuitry, but would cut by half the number of memory cells required. When communicating over 100-base-T or faster Ethernet, the cost of the circuitry necessary to detect multiple signal levels on the cable will likely be dwarfed by the cost of either having to use a cable with more wires or use cables that can handle more signal transitions per second without an unacceptable level of distortion.
There do exist quantum computers in research labs that use q-bit as the basic unit of information that can be both 0 and 1 simultaneously.
http://en.wikipedia.org/wiki/Quantum_computer
There have also been ternary quantum computers built as per this reference http://en.wikipedia.org/wiki/Ternary_computer
So, It is indeed possible to build alternative computing devices that do not rely on the binary number system. Fiber optic systems for example use 0 for dark and two different orthoganal polarizations of light as 1 and -1.
The reason why I mention these things is because I want to show that although binary numbers are sufficient for computing, there are alternative number systems that can be used for computing.
The binary number system is nice in these sense we can encode all integers by using radix representation of numbers. http:// en.wikipedia.org/wiki/Radix These values can represent the ASCII code A=0x41=01000001, or the value could represent a machine instruction nop=0x90=0x10010000.
At the heart of the digital computers processing power is a transistor, which works like a switch. By raising the current at at the "gate" of the switch, it allows current to flow between the "collector" and "emitter" - the switch is turned on. The transistor will be designed to operate in one of two modes - fully on or fully off ('saturated') - with a clear division of what those states are. The transistor can switch between the two states quickly, will remain in the state with very limited errors.
This circuitry forms the basis for logic devices, such AND, NAND, OR, XOR and other functions. The NAND function being the most basic of the building blocks. These logic devices are assembled to provide processors which remain in a predictable state, and lots of transistors can be packed in a small space to provide the functionality needed.
A transistor can manage multiple, or varying states, but when operating in that manner they do not produce conventional "digital" computers - they do not tend to stay in a predictable state and they are prone to interference, saturation, osculation, etc - so they have limited applications in terms of computational abilities. Op-amps could be considered analog computers.
We only use binary(1,0) because we currently do not have the technology to create "switches" that can reliably hold more than two possible states. (Quantum computers aren't exactly on sale at the moment.) The binary system was chosen only because it is quite easy to distinguish the presence of an electric current from an absense of electric current, especially when working with trillions of such connections. And using any other number base in this system ridiculous, because the system would need to constantly convert between them. That's all there is to it.