0 votes
in General Knowledge by (773k points)
Let's say I have the executable hello which prints hello world to the screen, and I run it by typing the name of the executable into the shell and then press enter. How does this work given a system's hardware organization?

1 Answer

0 votes
by (773k points)
 
Best answer
Each character the user types in gets stored as bytes in the I/O controller, travels to the I/O bridge through the I/O bus, and then travels to the bus interface in the CPU using the system bus. Then, the byte is stored in a register in the register file.

Once the user hits enter, the character bytes stored in the register file leave the CPU through the system bus, pass through the I/O bridge, and then ride the memory bus into main memory.

The hello executable stored on disk is then loaded by copying the code and data in the hello object file from disk directly to main memory (this process is known as direct memory access/DMA).

Now the processor begins executing machine-language instructions in the hello program's main routine. These instructions copy the bytes in the "hello world" string from memory to the register file, and from there to the display device, where they are displayed on screen.
Welcome to the Answerine , a great place to find, read and share your favorite questions and answers.
...