In the third lecture we delve into the complex mechanisms and policies that enable the operating system (OS) to effectively manage CPU virtualization and time sharing. The lecture introduces the concept of creating the illusion of multiple virtual CPUs through a cyclical process where the OS alternates between running and pausing different processes. This is achieved through a combination of low-level mechanisms and high-level scheduling policies, which determine the order and efficiency of process execution based on historical data, workload, and performance metrics.
Central to this discussion is the abstraction of a process—an instance of a running program characterized by its interaction with various system resources such as memory, registers, and persistent storage. The lecture outlines the Process API, encompassing creation, destruction, waiting, control, and status operations, highlighting the lifecycle of a process from its initiation and memory allocation to its execution and management of state transitions (running, ready, and blocked).
Furthermore, the lecture covers the intricate details of process creation, including code loading, memory allocation for the stack and heap, and initialization tasks like setting up I/O descriptors. The transition of a process through various states and the importance of the Process Control Block and Process List in maintaining an organized structure for managing processes within the operating system are also emphasized. Through the lens of the Xv6 operating system, an example of a UNIX-like OS from MIT, the lecture concludes by illustrating the practical application of these concepts in real-world OS design and operation.
Understanding Copy-On-Write (COW) Mechanism
This video is absolutely hilarious to watch. It will really help you understand process states.
https://youtu.be/MB0yDMQj1lU?si=ntxleNIyo8nh7nwx
Original Slides:
https://docs.google.com/presentation/d/19RdZmg_RDlM0KlYG_qduvnp6nvviEccgVrwTzl4Ivmw/edit?usp=drive_link
2024 slides:
https://docs.google.com/presentation/d/1GeAPiLD6AUJ5yiX5OuXGlbftA-w7A8RrIL0eTjaUzOo/edit?usp=sharing
There is no example code for this lecture.
Code examples from the book