By my understanding, operating system is the abstraction layer above hardware. Which means that an operating system that supports two different CPU architectures can run the same code. But I still cant understand the details/steps of executing a given program.
Suppose, I have a program that takes 2 numbers from the user, adds them and displays the answer. There are few steps in which the program does its work (Might be missing something or wrong somewhere, feel free to correct):
1) Double clicking the program file icon.
(a) How do the GUI and the mouse (and RAM) interact to identify which icon is clicked?
2) Loading of program in the Main memory using the address of the icon clicked.
(b) How is the os involved in finding that file from the disk?
3) Input of 2 numbers (CPU reads instructions of taking input from keyboard).
(c) Will the example of 2 different keyboards (For eg: one with 'fn' key like in laptops and one of full size) be a good example for explaining the need of device controllers and drivers?
4) Adding of the 2 numbers (Arithmetic operations).
(d) Is the os responsible for providing the CPU with the addresses of the operands and operators?
5) Displaying the output on the monitor.
I understand that the question might be broad, but I am not able to piece together all these things just by reading books (like 'Operating System Concepts by Galvin').
Also, I like as much detail as possible as it makes things more clear.