J
J
Jungles2020-08-26 21:56:03
binary code
Jungles, 2020-08-26 21:56:03

Compiling to machine code?

The compiler turns the code into machine code (0 and 1)
And where does the processor get instructions on how to read this code?

Everything eventually turns into a stream of millions of bytes, and this is only for one program, and if there are several of them. How do programs work without collisions? (parallelization, interrupts?)

Here I will write code conditionally in python
1 + 2, it's like __add__(1,2) , __add__ also has a binary representation. What does it mean? Location of the cell on the processor where the addition takes place? How to turn it into machine code with the same operation, so that I conditionally give it to the processor and it returns the result to me.

Phew, broke

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Kuts, 2020-08-26
@fox_12

> Where does the processor get instructions on how to read this code?
Compiled code - zeros and ones - are stored in a certain area of ​​memory.
The processor starts the counter - from zero, for example - and reads the memory cells from 0 - let's say 0001 is stored there - and the processor has a command directory. And if 0001 is stored, then this means that the next two memory cells store operands that need to be added and sent to the register - a special memory cell. Here it performs an action on these commands and increments the counter in itself - a command and two operands - which means the counter has increased by 3. Now the counter points to memory location 3 - and it reads the next command. Etc....

D
dollar, 2020-08-26
@dollar

The instructions are hardwired into the processor itself in the form of an integrated circuit.
Or what do you think the processor is?
Google the word: opcodes
Programs run without collisions, with interruptions, using the services of the operating system, which, in turn, uses the capabilities of the processor. Modern processors support multitasking. Although multitasking can be implemented at the OS level, in software, it is obvious that hardware is faster.

1
15432, 2020-08-26
@15432

And where does the processor get instructions on how to read this code?

There is microcode in the processor, which parses the machine code ..
And the microcode itself is executed in hardware, the transistors are configured like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question