cd week_two

Journal Entry Week 2

    This week felt like things got way more complexed compared to last week. Before, it was kind of big-picture stuff like “what an OS is,” but now we actually started digging into how it really works under the hood, especially with processes and CPU stuff.

Topics We Covered

  • Processes (what they are and how they work)
  • Process states (running, ready, blocked)
  • Process API (fork, exec, wait)
  • CPU virtualization
  • Context switching
  • Scheduling basics (FIFO, SJF, STCF, Round Robin)
  • Intro to more advanced scheduling like MLFQ

Explaining the Topics

    A process is basically a program that’s actually running, not just sitting there as code. The OS takes that program and turns it into something active, with memory, and registers.

    The whole idea of CPU virtualization finally clicked a bit more this week. The OS is basically juggling a bunch of processes by switching between them really fast, so it looks like everything is running at the same time even though there are limited CPUs.

    The process API stuff (fork, exec, wait) was pretty cool. The idea that fork() basically clones the process and then both continue running feels super confusing at first. And then exec() just replaces the program completely. Though this was confusing, it's obvious how powerful these are.

    Scheduling was another big part. FIFO is straight forward and not efficient in regards to turnaround time and response, SJF tries to be more efficient by running short jobs first, and Round Robin tries to be fair and responsive by giving everyone a turn. Then MLFQ tries to combine all that by basically learning how processes behave over time.

Least-Understood Topics

    The hardest stuff for me this week was the low-level CPU stuff like how the OS actually takes control back from a running process. I get that timer interrupts exist, but picturing that happening in real time is still fuzzy.

    Also context switching. I understand the idea is to save one process and load another, but the actual mechanics with registers, stacks, and switching modes from user to kernel and back, feels like a lot going on at once.

Nature of My Confusion

What makes sense:

  • OS switches between processes really fast
  • Scheduling is basically deciding who runs next
  • Different algorithms try to optimize different things such as: fairness vs speed

What’s still confusing:

  • How the hardware and OS coordinate during interrupts
  • What exactly is happening step-by-step during a context switch
  • How all of this happens so fast without everything breaking

It feels like I understand the story, but not the play-by-play yet.

“Aha” Moments

    The biggest “aha” moment this week was realizing that scheduling is basically a trade-off problem. You can’t have perfect fairness and perfect performance. That made a lot of the different algorithms make more sense instead of just feeling random.

    Also MLFQ clicked in a cool way. It’s basically the OS making guesses based on behavior. That idea of “learning from history” made it feel way more practical instead of theoretical.

Questions / What Comes Next

I’m wondering:

  • How do real systems actually choose between all these scheduling algorithms?
  • How accurate are these “predictions” in MLFQ?
  • Are we going to go deeper into how context switching is implemented in actual code?

Also curious if we’ll connect this more with concurrency soon, because it feels like everything is leading into that.

Connections to Other Classes

    This connects a lot to C programming again, especially with memory and processes. 

    Also kind of connects to databases with scheduling and fairness, like transactions competing for resources feels similar.

Final Thoughts

    Overall, this week was definitely harder than the first, but also more interesting. It feels like we’re getting into the actual engine of the OS now. I won’t lie, a lot of it didn’t fully click the first time through, but after rereading and thinking about it, it’s starting to make more sense.

    Still a little confusing, but in a good way.

Comments

Popular posts from this blog

Cohort 24 Take Off

Week Força

Week Toosie