Add keyboard output gif

This commit is contained in:
Philipp Oppermann
2020-03-23 16:07:47 +01:00
parent 9e5e993a1b
commit 8d3cdf62e3
2 changed files with 2 additions and 2 deletions

View File

@@ -1383,9 +1383,9 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
When we execute `cargo xrun` now, we see that keyboard input works again: When we execute `cargo xrun` now, we see that keyboard input works again:
TODO image ![QEMU printing ".....H...e...l...l..o..... ...W..o..r....l...d...!"](qemu-keyboard-output.gif)
If you keep an eye on the CPU utilization of your computer, you will see that the `QEMU` process now keeps one CPU completely busy. This happens because our `SimpleExecutor` polls tasks over and over again in a loop. So even if we don't press any keys on the keyboard, the executor repeatedly calls `poll` on our `print_keypresses` task, even though the task cannot make any progress and will return `Poll::Pending` each time. If you keep an eye on the CPU utilization of your computer, you will see that the `QEMU` process now continuously keeps the CPU busy. This happens because our `SimpleExecutor` polls tasks over and over again in a loop. So even if we don't press any keys on the keyboard, the executor repeatedly calls `poll` on our `print_keypresses` task, even though the task cannot make any progress and will return `Poll::Pending` each time.
To fix this, we need to create an executor that properly utilizes the `Waker` notifications. This way, the executor is notified when the next keyboard interrupt occurs, so it does not need to keep polling the `print_keypresses` task over and over again. To fix this, we need to create an executor that properly utilizes the `Waker` notifications. This way, the executor is notified when the next keyboard interrupt occurs, so it does not need to keep polling the `print_keypresses` task over and over again.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB