Search code examples
architectureoperating-systemsystemhardware

What are the processes involved in computation, since key pressing until the visualization of information in the monitor?


I was thinking yesterday and realized that my notion of computational processes is very abstract.

I would like to understand in detail the whole process since someone presses a key on the keyboard and a letter appears in a document in word, displayed on a monitor.

I would like to understand the processes in the hardware, operating system, and application level, and how they all interact.

Does anyone know of any reference with such an explanation? Or can anyone provide a good explanation of these processes?


Solution

  • Depends on the keyboard :-) In general:

    1. keypress on keyboard is being sent from keyboard over USB using USB HID Protocol
    2. USB controller on motherboard accepts signal and routes to an interrupt
    3. CPU handles interrupt and routes to Windows ISR to handle keypress
    4. Windows calls back to MS Word to handle keypress
    5. MS Word logically adds a character to the document
    6. Screen repaint requested (generally async)
    7. Word works with Windows APIs (depending on version, but likely something like DirectWrite or Direct2D) to paint the characters on the screen
    8. User marvels at all the layers of software working together seamlessly and invisibly to once again capture their unique and beautiful thoughts (or grocery lists).

    Any one of these could be a couple of pages (or books), but this is generally the cycle. I haven't done windows programming in a LONG time (multiple decades), so I may have some of the bits slightly off.