r/AskComputerScience • u/YounisMo • Jan 07 '26
Optimality in computing
So this question is gonna be mouthful but I have geniune curiousity I'm questioning every fundamental concept of computing we know and use everyday like cpu architecture, the use of binary and bytes, the use of ram and all the components that make a up a computer, a phone or whatever Are all these fundamentals optimal? If we could start over and erase all out history and don't care about backward compatibility at all How would an optimal computer look like? Would we use for example ternary instead of binary? Are we mathematically sure that all the fundamentals of computing are optimal or are we just using them because of market, history, compatibility constraints and if not what would be the mathematically and physically and economically optimal computer look like (theoretically of course)
10
u/AlexTaradov Jan 07 '26
There is no abstract "optimal". Things are optimal in relation to a specific task. Binary is optimal in terms of reliable manufacturing, and it is fits well enough with computation.
While theoretically there are advantages to ternary logic, even Setun, which is one of the most famous examples of ternary machine used two magnetic cores wired in parallel to get 3 stable states. This is the same number of cores required to store 2 bits, which represent 4 states. So practical implementation was less efficient than equivalent binary. They also could not come up with a better way to make tri-stable element.
There are plenty of systems that don't need to maintain backwards compatibility, but they still make similar design decisions.
At the same time there are many systems that use non-binary values (new hard drives, QAM modulation), but those still largely operate in powers of two. This realistically has nothing to do with binary being better, but done to match the binary systems they have to work with.
2
u/not-just-yeti Jan 07 '26
See also Church-Turing thesis: people came up with very different models of computation (Turing machine, random-access machine [closest abstraction to our usable hardware], abacus machine, analog computers, lambda calculus, and more); they have all been shown to be equally able to compute problems, and (for "efficiency") usually within a factor of n (the size of the input) or less. These models are so different (and yet, still translatable to each other), so the "thesis" is that there are NOT any undiscovered models of computing out there that can do more than these abstract models. That doesn't address your "efficiency" directly, but is a good background-concept that your question touches on.
1
u/flatfinger Jan 07 '26
The biggest mistake was the effort to use C as a replacement for FORTRAN rather than focusing efforts on making FORTRAN suitable for modern non-punched-card-based systems.
FORTRAN was designed to be a deli meat slicer. C was designed to be a chef's knife.
Add a powered feed attachment to a deli meat slicer and one will have a deli meat slicer.
Add a powered feed attachment to a chef's knife and one will have a worse deli meat slicer.
1
u/kohugaly Jan 08 '26
One major hurdle that modern computation faces is that the model of CPU+RAM is an illusion. It was true in early days when CPUs were slower than RAM. Modern CPUs work at such high frequencies, that information can't make a roundtrip between CPU and RAM even at lightspeed.
Modern CPUs solve this by having several layers of cache in the CPU chip itself, and very sophisticated mechanisms to pre-fech data into them, and to synchronize data between RAM and the CPU cores. All to maintain the illusion that each address refers to specific place in memory.
Writing software that plays ball with this caching is pure alchemy. Often there's no way to predict the performance of the program, other than to actually experimentally test it. And the penalty for failing to play nicely with caching can be up to 1000x slowdown.
GPUs largely avoided this issue, by having multiple different kinds of memory, that are hardware-optimized for different kinds of access (read-only, write-only, global, local,...), and expose the control over this memory to the programmer.
If we went to the drawing board, I suspect we would acknowledge these different memory kinds, and more explicitly embrace the parallelism in the CPU design too. And expose the control over them to the programmer. There would likely be no need for dedicated GPUs, because the CPUs would be able to leverage the same hardware tricks that make GPUs fast.
Also... if we are already acknowledging there are different kinds of hardware memory with different access tradeoffs... why stop at what's traditionally considered RAM? Storage in SSDs and hard-drives is memory too. So is network access. So are peripheral IO devices.
1
u/jonathaz Jan 08 '26
Kurzweil covers the topic of fundamental limits of computing power in “The Singularity is Near”. IIRC basically the fundamental limits to how much you can do with 1 Kg, but it’s been a couple decades since I read it. Those kind of estimates would be irrespective of the technology. He might have covered quantum computing but a lot has happened since 2005.
1
u/pixel293 Jan 09 '26
I feel like this would be better in an EE sub. EE geeks built the computer, we just build the applications on top of it. All we want is a deterministic machine where the same inputs produce the same outputs. I rarely think about binary, unless I'm doing a bit mask and trying to cram a bunch of data into a native data type. Likewise how that data is stored in memory or on disk, doesn't really mater, I just want the data I write out to be read back in correctly.
3
u/wrosecrans Jan 08 '26
Nah. In some ways trinary is mathematically "better" than binary. Most modern flash storage uses multiple levels per cell for the actual storage then converts it to binary for the host interface. Eight bit bytes are pretty arbitrary and based on being big enough for an ASCII character rather than any fundamental theoretical correctness.
You ask "are we just using them because of market, history, compatibility" But "just" is doing a hell of a lot of work in that question. Those factors are wildly significant to the variables most people want to optimize when designing a computer.
When you talk about being optimal you have to be specific about what you want to optimize for (unless you work for the marketing department.) If you come out with a 1MHz computer that uses trinary logic instead of binary that costs $100,000 and has no software, nobody will care about your product because it would be solidly suboptimal from a cost-benefit perspective for any company to buy a slow expensive and incompatible computer.
2
u/AdreKiseque Jan 08 '26
We could definitely make huge improvements in software if not for backwards compatibility. But the deepest foundations? Finding a completely new approach that could be theoretically better is probably the kind of thing you could write a research paper on.
2
u/PANIC_EXCEPTION Jan 08 '26 edited Jan 08 '26
Ternary may find some use in newer AI applications like BitNet (a.k.a. the 1-bit LLM), which is implemented efficiently with natively ternary hardware. But binary is more intuitive in hardware (CMOS).
Other choices like word lengths, etc. are good enough and not much benefit is to be had from improving them further. Perhaps you could remove legacy instructions entirely from a computer architecture to save on die area. There are practical limitations to making words larger and larger, especially for memory access. Wider words mean larger lanes, which takes up die area as well as increasing parasitic capacitance and crosstalk. You'll find that some 64-bit processors actually use 48-bit wide physical addressing to save on area, since practically nobody will ever use the full 64 bit capacity. Also, 64 bits gives you headroom to provide the virtual memory abstraction, letting you do things like map IO devices and physical memory to a giant virtual memory space, and have your stacks and heaps start in wildly different locations, growing in opposite directions, and ASLR for security.
1
u/Sexy_Koala_Juice Jan 08 '26
No we’d still be using Binary, simply because that’s 2 states of electricity, High & Low / On & Off.
It would develop largely the same IMO
0
u/ghjm MSCS, CS Pro (20+) Jan 07 '26
In at least some mathematical sense, ternary would be "more optimal" than binary, because 3 is closer to Euler's number than 2 is. There have been attempts to build ternary computers, but they have never become popular because of the manufacturing complexity.