Hi! On 19:06 Thu 05 Mar , sahlot arvind wrote: > Got it!.I have another question: > What are the exact steps when I press a key? Assume only one shell is > running and I press 'd': > 1. processor will get interrupted. > 2. it will jump to the common interrupt handler > 3. common interrupt handler will save the context of shell and will call the > appropriate interrupt handler (driver's part) in this case keyboard driver > 4. key board interrupt handler will run and read the data from keyboard > memory or registers etc and then return to the common interrupt handler > 5. common interrupt handler will restore the context of shell > 6. shell will resume > > Now in the above scenario I am missing something and that is how the data > (from keyboard) in this case 'd' gets delivered to the shell. I mean I > understand up to the point where keyboard interrupt handler reads the data > from keyboard mem or registers but where does it put 'd' back? Does keyboard > driver send 'd' to the display driver internally and then to shell? OR 'd' > is delivered to the shell and shell then sends it back to the display driver > to display it onto the screen? > Anyway in any case how does shell get the 'd' or anything from the keyboard? > What are the exact steps? I am not that much into The TTY layer so I cannot give you an exact answer. But usually the data flows like this: - Process wants to wait for data and calls e.g. getchar or something like this - Kernel sees that there are no pending chars to read and puts the process to sleep - Key is pressed - Interrupt handler is executed - Interrupt handler look for the process with is running foreground and puts the pressed char into the "pressed chars" queue of the process and wakes the process if it sleeps in getchar - The process receives the char and might pass it on (e.g. xorg) Instead of waiting in the system call there are cases where the user space program does some work and the event gets delivered via signals. -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ