Pregunta

What happens to a program post the machine code state? An assembler/compiler will convert high level code or assembly code to machine instructions. At this stage, the machine instructions is still in the software form and reside in memory. How is this code converted to physical electric signals that can then be processed by the hardware? If there is some kind of interface device, I would like to know how it does the conversion.

¿Fue útil?

Solución

From the time your muscles and fingers touch the keys on the keyboard the source code becomes electrical signals. this continues through compiling and execution. There is a book by Petzold called Code, you might find it interesting.

Otros consejos

Memory is physical. A memory device is queried by the processor for the next instruction. In response to a the processor's setting high or low voltages on 32 actual wires which select the address of the memory location. The memory is designed to, in return, provide high or low voltages over a set of 32 wires. These wires are called a data bus and are routed back to the processor where the high or low voltage states are sampled and placed in a smaller memory called the instruction cache. The values read from the memory are the physical representation of the mathematical representation that we call machine code.

From there on, the processing continues in the form of digital logic. Although it can be expressed as mathematics or symbols, the actual physical manifestation is logic circuits that sense inputs as high or low voltages, and respond to other parts of the circuit with high or low voltages. Timing is controlled by oscillating some of those signals high or low with a very regular time interval between.

Dwelch is correct. The moment you touch the keyboard (or mouse or touchscreen). Software inside the computer is nothing but storage of voltages through the use of latches/flip-flops (transistorized circuits). When you type in code via key board (high level language like C or low level like assembler does not matter), it is getting entered as electrical signals (voltages). However, what you see on your monitor is a representation of the voltages in english or english like text (now a days all languages of the world).

The point is text does not get converted into electrical signals. The software is already in that form (voltages), not the other way around.

There is no moment where software instructions are converted into hardware instructions. Even the process of converting code in a high-level programming language to a low-level programming language is done by the hardware underneath.

It is no different from asking the computer to execute the generated machine code because that's all the computer does: executing machine code. When a binary executable has been created, the computer simply needs to know where it is in memory and it can start executing it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top