Throughout this semester, we expect that you will read the entire implementation of the xv6 kernel, accompanied by the xv6 book, which explains the rationale and design underlying the kernel's implementation. (The source code is also available as a Lions-style PDF)
For this lecture, read the code for sleep() and wakeup() in kernel/proc.c; uartwrite() and uartintr() in kernel/uart.c; and all of kernel/pipe.c.
Look for this line in uartwrite() and comment it out:
sleep(&tx_chan, &tx_lock);
Start xv6 with make qemu. What goes wrong? Why?
You will likely find gdb helpful.
Optional challenge: can you modify uartwrite() to work better (perhaps continue for a few more characters of output), without calling sleep()?
You may find Chapter 9 of the book useful in understanding sleep and wakeup.
Submit your answer in an ASCII text file named homework.txt to the corresponding "Lecture N" assignment on Gradescope.
Questions or comments regarding 6.1810? Send e-mail to the course staff at 61810-staff@lists.csail.mit.edu.