Stage 16
Console Input
XSM uses asynchronous I/O on encountering load, store, IN. Since the CPU didnt wait for the data, Interrupt is raised. (The hardware signal is checked only after running a user instruction).
The IN instruction does not wait for the data to arrive at P0, it advances.
So the process on encountering the INT puts the process in WAIT_TERMINAL and invoke the SCHEDULER
The Console Interrupt must transfer the data in P0 to the input buffer field of the PROCESS TABLE. On encountering the console interrupt, WAIT_TERMINAL → READY.
On the occurence of a terminal interrupt, the interrupt handler uses the PID field of a terminal status table to identify the correct process that has acquired the terminal.
For a terminal read, the file descriptor (-1 for terminal input). The system call is interrupt 6.
The read system call invokes the Terminal Read function present Device Manager Module.
The Terminal Read must perform the following.
1) Acquire the terminal
2) Issue an IN instruction
3) Set its state as WAIT_TERMINAL
4) Invoke the scheduler
5) After console interrupt wakes up this process, transfer data present in the input buffer field of the process table into the word address.

