cd week_four

 Journal Entry Week 4

Topics We Covered

  • Free-space management (malloc/free, fragmentation)
  • TLBs (Translation Lookaside Buffers)
  • Multi-level paging (smaller page tables)
  • Swapping / virtual memory beyond physical memory
  • Page faults and present bit
  • Page replacement policies (FIFO, LRU, Random, Optimal)
  • Cache performance (hit rate, AMAT, locality)

Explaining the Topics

    Free-space management is basically how memory gets handed out and taken back. The tricky part is fragmentation, where memory gets split into little pieces, and even if you technically have enough space, you can’t use it efficiently.

    TLBs are like a shortcut for address translation. Instead of checking the page table every time, which is slow, we cache recent translations so we can reuse them quickly. That makes a huge difference in performance.

    Multi-level paging solves the problem of page tables being way too big. Instead of storing one giant table, we break it into smaller pieces and only keep the parts we actually use. This saves a lot of memory but adds extra steps when translating addresses.

    Swapping is probably the biggest idea this week. It lets the system act like it has more memory than it actually does by moving less-used pages to disk. RAM becomes like a fast workspace, and disk becomes backup storage.

    Page replacement policies decide what to remove from memory when it’s full. FIFO removes the oldest, LRU removes what hasn’t been used recently, Random just guesses, and Optimal is the best possible but unrealistic since it needs future knowledge.

Least-Understood Topics

    The hardest topic for me this week was definitely page replacement policies. I understand how each one works, but figuring out which one is actually the best is confusing because it depends so much on the workload.

    Also, swapping itself is a little hard to picture in real time. I get the idea of moving pages between RAM and disk, but I’m still trying to fully understand how often that happens and how the OS avoids slowing everything down too much.

Nature of My Confusion

What makes sense:

  • RAM is limited, so we need disk as backup
  • TLB = fast cache for translations
  • LRU tries to keep important pages

What’s still confusing:

  • How the OS decides exactly which page to evict in real systems
  • How often page faults happen in practice
  • How swapping doesn’t completely kill performance

    It feels like I understand the logic, but not fully how it behaves in a real system under heavy load.

“Aha” Moments

    The biggest “aha” moment this week was realizing that memory is basically just a layered system of caches. Registers > RAM > disk. Everything is just about keeping the most important data in the fastest place.

    Another big moment was understanding locality. Once that clicked, a lot of things made more sense like why TLBs work, why LRU works, and why some workloads perform better than others.

Questions / What Comes Next

I’m wondering:

  • How does the OS detect when it’s swapping too much (thrashing)?
  • How do real systems balance performance vs memory usage?
  • Are there modern algorithms better than LRU that are actually used?

    I’m also curious if we’ll go deeper into how these policies are implemented in real systems, especially with hardware support.

Connections to Other Classes

    This connects a lot to C programming again, especially with malloc/free and memory usage. It also connects to computer architecture with caching and performance.

Final Thoughts

    This week was definitely one of the more challenging ones, but also one of the most interesting. It feels like we’re finally seeing how memory virtualization actually works in real systems.

    There’s still some confusion, especially with replacement policies and swapping behavior, but I'm sure I'll make better sense of everything in time.

Comments

Popular posts from this blog

git checkout -b review-markov

Week Força

Week Toosie