Nixers Book Club - Book #6: Introduction to Operating Systems Abstractions - Community & Forums Related Discussions
Users browsing this thread: 2 Guest(s)
|
|||
Book club time, happy new year.
# Chapter 11 A chapter about threads and channels. Threads are independent of processes and so they have their own threadID. I think we call that user-level threads in comparison with the different types of mapping of kernel-level threads out there, user-level threads are many-to-one. I was once wondering about benchmarks, but it seems it's not very relevant: https://nixers.net/Thread-Benchmarking-Pthread Quote:One problem with Plan 9 threads is that a blocking operation, such as I/O, blocks the entire process, rather than blocking a single thread. The thread library provides a proccreate(2) routine we can use to create a new thread wrapped in a new process.I hadn't thought of that but yes. There is no main when including thread.h, the entry point is threadmain instead. Interestingly to create thread we pass a stack size. Channel concept is very interesting, clean. It reminds me of the same concept I've seen in Rust https://doc.rust-lang.org/rust-by-exampl...nnels.html. # Chapter 12 Chapter 12 is about user input/output. It's pretty linear, going from driver to driver and checking what they do. They're all files starting with #. Console is `#c/cons` file. You can use `#c/kprint` to read what's written to that console. Then we learn that there are cooked mode terminal and raw ones. Similar to the line on Unix (line at a time). `/dev/consctl` can be used to switch between raw and cooked mode. One nice thing is that in cooked mode there's a "hold mode", enabled with escape, to send multiple lines at once instead of directly. Plan9 uses unicode, it was the first system to use it. It calls characters "runes", 16-bit UTF-8. The alt gr system is similar to the one with libinput/X11. Mouse input driver is in #m and shows in a virtual file the mouse events /dev/mouse. Video driver is in #v, aux/vga and /dev/vgactl can be used to control the vga driver. On that the display and screen globals in the code makes the programming a bit weird. Finally, controlling windows with files is pretty fun. |
|||