Hardware Components
What happens when we run an executable?
- as we type the characters
./hellointo the shell program, each letter is read into a register (in the CPU), and then stores it in memory - When we hit
<enter>, the shell loads the executablehellofile by executing a sequence of instructions that copies the code and data in thehelloobject file from disk to main memory (included is the string of characters"hello, world\n") - the data then travels directly from disk to main memory, without passing through the processor (a technique known as direct memory access)
- Once the code and data of the
hellofile are loaded into memory, the processor begins executing machine-language instructions in thehelloprogram'smainfunction.- These instructions copy the bytes in the
"hello, world\n"string from memory to the register file (CPU), and from there to the display device (monitor).
- These instructions copy the bytes in the
Children