Week 2 (7/2/2025-7/8/25)
What did I learn this week at CST334:
The major tools I learned this week in OS are processes, limited directed execution, CPU scheduling, MLFQ, and C Process API. I learned that limited direct execution is used to ensure efficient multitasking. It lets user programs run directly on the CPU, but in a safe way using user mode. The OS uses traps and interrupts to regain control when needed, such as during I/O or when a timer expires. This allows the OS to safely switch between processes, a process known as context switching.
I also learned that processes are created and managed by the OS using tools like fork() (to create a new process), exec() (to replace the process code), and wait() (to wait for a child process to finish). Each process has its own state and memory.
I also studied different ways the OS schedules which process runs next. CPU scheduling policies determine the order in which processes are executed. First-Come, First-Served (FCFS) is simple but can lead to poor performance. Shortest Job First (SJF) minimizes average turnaround time if job lengths are known. Shortest Time to Completion First (STCF) is a preemptive version of SJF. Round Robin (RR) assigns each process a short time slice in turn, improving response time but potentially increasing turnaround time.
Finally, I learned about Multi-Level Feedback Queue (MLFQ), which adjusts process priorities over time. Short or interactive jobs stay at a higher priority, while longer CPU-bound jobs move lower. To prevent starvation, MLFQ boosts all jobs back to high priority from time to time.