Is it possible to deduce the software from the hardware activity?

  • Thread starter Aidyan
  • Start date
  • #1
169
12
Suppose one knows well the laws of physics but knows nothing about computers and IT. Would one be able to deduce how a computer works only by studying its hardware? Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
 

Answers and Replies

  • #2
35,629
7,500
Suppose one knows well the laws of physics but knows nothing about computers and IT. Would one be able to deduce how a computer works only by studying its hardware?
I don't think so. If one knows nothing about computers, it seems safe to say that one would also know nothing about the CPU, RAM and ROM modules, and all the other pieces that make up a computer, let alone how they work and what they are doing when a program is running.
Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
Seems very doubtful to me.
 
  • #3
anorlunda
Staff Emeritus
Insights Author
10,066
7,231
Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
Yes.

A number of resources on Youtube can help.

This is the channel:
https://www.youtube.com/c/BenEater

You can start with
"How semiconductors work."
"How a transistor works."
"Inverting the signal with an transistor."

An work your way up to building a working computer on a breadboard, to programming it, to advanced programming.
"8 bit computer"

In total, there are 76 videos, most about 10 minutes long, but ranging 5 to 38 minutes.

It is a good way to study, but it is still study. You have to put in the work to do it.

p.s. I see my answer is the opposite of @Mark44's. So be it. You can choose "no" or "yes".
 
  • #4
35,629
7,500
p.s. I see my answer is the opposite of @Mark44's. So be it. You can choose "no" or "yes".
My reply was conditioned on the hypothesis that one knew nothing about computers. Going through Ben Eater's videos would counter this hypothesis.
 
  • #5
169
12
My reply was conditioned on the hypothesis that one knew nothing about computers. Going through Ben Eater's videos would counter this hypothesis.
Indeed, Ben Eater does not deduce the workings of a PC, CPU, memory, etc. from scratch. He only explains to the public how they work on the basis of what he already knows.
 
  • #6
anorlunda
Staff Emeritus
Insights Author
10,066
7,231
Indeed, Ben Eater does not deduce the workings of a PC, CPU, memory, etc. from scratch. He only explains to the public how they work on the basis of what he already knows.
I'm not sure what you mean by scratch. But "How a semiconductor works" is pretty low level. Is that not scratch enough for you? If not, how deep do you want to go? Be warned, that at the bottom is quantum mechanics.
 
  • #7
169
12
I'm not sure what you mean by scratch. But "How a semiconductor works" is pretty low level. Is that not scratch enough for you? If not, how deep do you want to go? Be warned, that at the bottom is quantum mechanics.
So, once you have a semiconductor in your hand and analyze it, and even know about quantum physics but have no idea how an IT chip works and especially what it does, how would you proceed in deducing its function?
 
  • #8
821
698
So, once you have a semiconductor in your hand and analyze it, and even know about quantum physics but have no idea how an IT chip works and especially what it does, how would you proceed in deducing its function?
First they would look at it.
 
  • #9
berkeman
Mentor
61,289
11,796
but have no idea how an IT chip works
What's an IT chip?

Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
There are many, many ways to write software to do the same task.
 
  • #10
robphy
Science Advisor
Homework Helper
Insights Author
Gold Member
6,142
1,460
Suppose one knows well the laws of physics but knows nothing about computers and IT. Would one be able to deduce how a computer works only by studying its hardware? Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
Of course, modern computing technology using tiny microprocessors with billions of components has evolved from a handful of simple logic gates. So, it's fair to say that by looking at modern equipment hardware it is too difficult to unravel the computing code that runs on it. (In addition, some aspects of the code may never run or will rarely run.... how will that be uncovered?)

Like many things, one needs to study a simple system first.

(This might be interesting: an adder using Conway's game of life https://nicholas.carlini.com/writing/2020/digital-logic-game-of-life.html
Could one determine what this machine is doing by studying this [with its given set of inputs]?)
 
  • #11
169
12
First they would look at it.

Precisely. So, once one has "looked at it", what follows next? Say an extraterrestrial that knows well the laws of nature has to decipher how a human-made computer works (let us also assume it is still working and can analyze many of them). If someone knows all about electromagnetism, quantum physics, solid-state physics, etc., but nothing about the working principles that led humans to the construction of such complicated circuitry, can ET deduce what it is useful for, how it works, and especially how that circuitry achieves the specific tasks it performs?
 
  • #12
169
12
Of course, modern computing technology using tiny microprocessors with billions of components has evolved from a handful of simple logic gates. So, it's fair to say that by looking at modern equipment hardware it is too difficult to unravel the computing code that runs on it. (In addition, some aspects of the code may never run or will rarely run.... how will that be uncovered?)

Like many things, one needs to study a simple system first.
Ok, then let's assume that one discovers that there are gazillions of transistors. And begins with a bottom-up approach from there. Next would be to see how these transistors connect and interact with each other. Could one then discover that these form logic gates with some logical function? I guess yes... but am not sure. From there the next step would be to understand how these logic gates come together to form some CPU instructions, from there one might speculate "maybe these instructions correspond to the executions of a low-level programming language" (say assembler, sort of...), etc. But I suspect that this latter step is already too difficult if one does not know what the meaning and purpose of what we call a "programming language" is. Maybe it is even not possible in principle.

Overall I'm trying to understand if that is impossible (if it is) only because it is too difficult or also because it isn't possible, even not in principle? I'm wondering if that might connect to some sort of logical impossibility that tells us that something is not just too hard to figure out but even logically impossible (sort of Goedel's or Chaitin's incompleteness theorem)?
 
  • #13
381
281
CPU's have their own very low level programming language. You can connect to CPU's and run basic commands on them, I did this at College where we got to program the CPU directly using HEX to perform basics function like turning on a set of lights in sequence. This low level stuff you could find out by studying / reverse engineering the CPU.

Having said that it's all at a very basic level, just because you know what the CPU does at a basic level does not imply anything to the software running on top of that.

I.E. We could give someone not familiar with an Intel x86 type CPU the CPU and they could figure out the basic chip functions. That does not then imply that they could then create MS Windows or Linux just from studying the CPU. Sure if they had the concept of a GUI using a WIMP (Windows, Icons, Mouse, Pointer) they could try and create their own, but the secrets of an OS or software running on them cannot be reversed engineered just from the hardware.
 
  • #14
Klystron
Gold Member
895
1,305
Given sufficient knowledge of electronics one could determine the operating characteristics of a standard digital computer such as limits on input and output levels, power supply, possibly clock speeds, etc. The instruction sets / programs that run on digital computers are strongly limited by the electronic hardware but, by design, are not deducible from the hardware as these computers are designed to run a large array of programmable tasks, usually interleaved for efficiency.

Digital computers dedicated to a distinct task could carry this function in their electronic design in such a form as could be deduced form meticulous analysis of the electronics. Even so, this analysis would not produce the data sets -- the input/output -- of a dedicated digital computer run without a similar input stream. Complexity issues confounding analysis also come into play beyond simple examples.

Analyzing a dedicated analog computer design should yield more information concerning the computer function compared to a general purpose digital system. Given that form follows function in analog devices, that form should provide some functional information.

Take a simple analog device such as a ruler or 'wheel on a stick' used to measure length and perhaps a picture or video of an engineer employing the device. One could deduce the device measures distance from examination. This deduction does not preclude the device being used for purposes unrelated to measurement.
 
  • #15
2,120
1,461
Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
I would say the possibility exists, but to really do it would work only for some really specific problems/applications.
For general application like a PC - well, there are so many extra stuff there that sometimes even possession of the source code won't give you a hint about it's actual purpose.
Just think about all the user interface/GUI things, for example. To understand them backward starting from a debug would be a real major headache/PITA.
 
  • #16
169
12
The instruction sets / programs that run on digital computers are strongly limited by the electronic hardware but, by design, are not deducible from the hardware as these computers are designed to run a large array of programmable tasks, usually interleaved for efficiency.
But can someone not deduce from a series of instructions executed by the CPU a specific high-level instruction? Say, for instance, a set of assembler instructions representing a sum = var1+var2? (just Imagine an ET dealing with a human build PC.) If not, is that due to the fact that it is much too hard (but in principle possible for some superhuman intelligence) or because there is a logical reason that forbids it even in principle?

Complexity issues confounding analysis also come into play beyond simple examples.
I think of another complexity issue, namely that usually a high-level language is compiled. Is it possible to reverse-engineer from compiled data the program without knowing the compiler? I tend to believe that one would see only meaningless white noise that would be impossible to relate with anything if the compilation rules are unknown. But I have no strong opinion on this... maybe there is a way to do that?
 
  • #17
381
281
Seeing what the CPU is doing in real time is of no use if the commands its running are out of context, you don't know what the high level software is doing with that command, why it's running it, what it intends to do with the data, is it just setting up commands, is it the processing of actual "data" etc

Software can be de-compiled but you really need to know the language used to create it or just try them all until you get something legible. Even then it may not make any sense.

Why this line of questions if I may ask? It seems to me that your example of Superhuman intelligence / ET would be far more advanced than us and have no interest in our computing.
 
  • #18
169
12
Seeing what the CPU is doing in real time is of no use if the commands its running are out of context, you don't know what the high level software is doing with that command, why it's running it, what it intends to do with the data, is it just setting up commands, is it the processing of actual "data" etc
Ok... wait a moment. The conversation moved on the CPU but the originally it referred to the entire PC. The clever mind that knows everything about physics and also logic and math but nothing about human computing (ET or whoever) has nevertheless access to the hard drive, the SSD, or whatever memory in which the program is stored. It has all the program lines and also all the hardware. The question is whether they may be able to relate each other and make any sense out of it?

Why this line of questions if I may ask? It seems to me that your example of Superhuman intelligence / ET would be far more advanced than us and have no interest in our computing.
Firstly, a purely logical curiosity.

Secondly, if and in what sense today's efforts to decipher the brain's activity is comparable to this "retro-engineering"? There are actually several brain mapping projects aiming at mapping neuron by neuron the brain and simulating its neural networks in the belief that this will lead us to understand how our brain works and why it does what it does. One might object that brains do not run on a software-hardware basis, but are only hardware. But that could make things eventually even harder. If retro-engineering of a simple PC is a mission impossible, then it seems to me that these projects are doomed to failure as well.

Thirdly, the question of whether an extraterrestrial life form that would find a human space probe would be able to decipher what it was doing, the program running, etc.?
 
  • #19
381
281
I focused on the CPU as it is the brains, everything else is useless without it.

I would think there are far too many neurons to map the human brain properly, I see this as an impossible tasks for today's technology.

I would think an advanced civilisation would be able to determine what the instruments do on one of our space probes, physics is the same everywhere after all. Let's take a digital camera as an example, I would not think it would be that out of this world to determine the photo sensor turned photon input's into electrical signals. What happens with those electrical signals after conversion they may not figure out but they would still know it's an image capture device of some sort I imagine.
 
  • #20
821
698
Precisely. So, once one has "looked at it", what follows next? Say an extraterrestrial that knows well the laws of nature has to decipher how a human-made computer works (let us also assume it is still working and can analyze many of them). If someone knows all about electromagnetism, quantum physics, solid-state physics, etc., but nothing about the working principles that led humans to the construction of such complicated circuitry, can ET deduce what it is useful for, how it works, and especially how that circuitry achieves the specific tasks it performs?

It's actually not very complex circuitry. It's just there are a small set of types of somewhat simple circuits, and there are a lot of instances of those circuits. I think that after figuring out what the transistors are/do, figuring out what the circuits do is straightforward.

Once they figured out how the computer works, they would be able to write low level machine instructions. But they probably wouldn't be able to use the computer at hand, because it requires an operating system, and drivers, and input/output devices. So they would be without the necessary software, which is quite complex.

They would be able to build more primitive computers at first (like calculators) that replicate the internal digital logic, and it would take years to incrementally make the advancements in terms of operating systems, programming languages, compilers, algorithms etc. to get to a level like we are at now.

Edit: I was assuming they have the computer, but no software. I'm not sure what the task is exactly. Do they have a working computer with an operating system installed? They can run it and dump the binary of the compiled programs? They can open up Visual Studio and write code on it themselves? What do they have and what is the goal?
 
Last edited:
  • #21
DaveE
Science Advisor
Gold Member
2,041
1,656
Let's assume that you can identify everything about the structure and state of the machine. You are then left with the problem of how it was created. There may be multiple ways to create the same result.

So, for example, suppose the program is multiplying a vector times a matrix. In a high level language that could be done with a "for loop", a "while loop", or a "if then goto" construct, but those may be indistinguishable after it is compiled. There would be no way to know why the code cycles through rows before columns, or vice versa. Comments in the source code that describe why the code was written this way are not compiled.

So, there is no chance of recovering information that can have multiple versions for the same result, or for recovering information that the processing deems irrelevant to the execution of the code. Furthermore, you have no way of reconstructing what that matrix and vector represent to the person writing the code. Is it a QM problem, control system, optical ray tracing, network analysis, material failure analysis, math homework problem?

This whole idea reminds me of Laplace's Daemon and questions about determinism and free will. In the real world systems are much too complex to work backwards this way. But theoretically? Perhaps. Personally I find those sort of questions pointless, which is probably why I studied engineering instead of philosophy.
 
  • #22
388
151
My reply was conditioned on the hypothesis that one knew nothing about computers. Going through Ben Eater's videos would counter this hypothesis.
My two cents would be "maybe". It depends on the complexity of the actual software (think multi-theading), and the complexity of the CPU. Floating point unit? That depends on understanding or somehow decoding the representation. Deducing twos compliment for integer arithmetic? More likely. But fundamentally a basic CPU doesn't really have that many fundamental operations. Something like an 8088 would probably be easy to analyze and reverse engineer the assembly code if you could look at the machine state on every clock. Modern CPUs and software? It seems unlikely, but perhaps remotely possible.

There are a lot of modern constructs built into modern CPUs like prefetch, branch prediction, tlbs, page tables (virtual memory), caching, etc
that would probably make reverse engineering very difficult.
 
  • #23
vela
Staff Emeritus
Science Advisor
Homework Helper
Education Advisor
15,281
1,870
I don't see why not, given enough time. Isn't this essentially what scientists do—study a system to determine how it works? Researchers would discover Boolean algebra, gates, transistors, basic structures like flip flops, counters, etc., along the way. If anything, a computer should be simpler to understand since it's fairly simple conceptually.
 
  • #24
388
151
I don't see why not, given enough time. Isn't this essentially what scientists do—study a system to determine how it works? Researchers would discover Boolean algebra, gates, transistors, basic structures like flip flops, counters, etc., along the way. If anything, a computer should be simpler to understand since it's fairly simple conceptually.
I remember doing a project that was essentially taking a program and describing the machine state on an out of order execution processer. Something like a pentium 4. I do wonder if that is "invertible", I'm not prepared to give a proof one way or another, but it does feel like a "hard" problem with the way modern processors work.
 
  • #25
Suppose one knows well the laws of physics but knows nothing about computers and IT. Would one be able to deduce how a computer works only by studying its hardware? Could one rebuild the software code and understand its meaning only by looking at the internal flow of bits in its CPU?
Possibly. You would need to observe and record output in response to inputs. Then you need to create flow charts for operations (black box approach). Then you would need to get the instruction set of the chips inside. Then you might be able to create the low level operations from the flow charts. You might then be able to deduce the compiler operations. That might close the loop. Wish you a long and happy retirement (you won't earn money doing it)! Aliens? Well they would get at the original design data (its there somewhere stored in the Earth's digital repositories). But then they probably have other ideas for visiting us.
 

Related Threads on Is it possible to deduce the software from the hardware activity?

  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
9
Views
2K
  • Last Post
Replies
12
Views
5K
Replies
4
Views
2K
Replies
7
Views
4K
Replies
3
Views
1K
  • Last Post
Replies
23
Views
6K
Replies
18
Views
3K
Top