Posts

Showing posts from July, 2025

CST 334 - Week 5

Week 5 Overview: This week in CST 334, I learned a lot about locks and concurrency. The most interesting part was understanding how different types of locks work especially spin locks vs ticket locks. At first, I thought all locks were the same, but now I see how much design actually matters. Spin locks are simple but waste CPU cycles under high contention. Ticket locks are smarter. They use a “take-a-number” approach, which makes things more fair and avoids starvation. We also learned about hardware instructions like test-and-set and compare-and-swap. These are used to build locks at a lower level. It really showed me how messy things can get when threads share data without proper coordination. Even a small race condition can lead to unpredictable bugs. We also had the midterm this week, which was honestly rough. The one-hour time limit was tight, and it felt super rushed, especially since we’ve had unlimited time on quizzes before. Some of the questions were a lot harder than expecte...

CST 334 - Week 4

CST 334 Week 4: This week was honestly a bit of a grind, but I learned a lot. We were working on virtual memory and page tables stuff I’ve heard of before but never actually had to code myself. The main task was writing a function that maps a virtual page to a physical one, while setting all the right permissions like read, write, and execute. Sounds straightforward, but once I started getting into bit manipulation and flags, it got confusing really fast. One tiny mistake like shifting something the wrong way or using the wrong constant would break everything, and sometimes the errors didn’t even point me in the right direction. On top of that, clang-tidy was being super picky this week. It wasn’t just finding actual bugs it was complaining about random stuff like not having curly braces around one line if statements or using a plain number like 8 in a calculation. At first, I didn’t even understand what the warnings were trying to say. I ended up copying the error logs into ChatGPT ju...

CST 334 - Week 3

Week 3 Summary: This week in CST 334 was a rollercoaster. We started working on PA3, which is all about building a memory allocator. Basically our own version of malloc() and free(). At first, I thought, “okay cool, pointers and structs again,” but this assignment humbled me quick. Managing memory manually, keeping track of chunks, splitting them, and then coalescing them back together sounds simple on paper but actually implementing it without causing segmentation faults or crashing everything was tough. One thing that stood out was just how fragile everything becomes when you're directly manipulating memory. A wrong pointer or forgetting to update a linked list will break the whole thing. A lot of my time was spent debugging and going through each line of my code just to figure out where things were going sideways. The split_node function specifically gave me a hard time. It took me a while to realize how important it is to keep the fwd and bwd pointers clean or everything falls ...

CST 334 - Week 2

Week 2 Summary:  This week in CST 334, we dug into how operating systems handle processes, and honestly, things are starting to make more sense now. I’ve heard the term “context switching” before, but I never really got what it meant until we broke it down. Learning the difference between voluntary and involuntary switches like when a process is just waiting for input vs. when the OS forces it to stop, helped a lot. It’s kind of wild to think about how much the OS is doing behind the scenes just to keep everything running without us even noticing.  We also got into how processes are created in C with fork(), exec(), and wait(). The fork() function really threw me off at first. I was like is the same program just running twice? But it made sense after printing out a bunch of values and looking at the return codes. It’s pretty cool how the parent and child processes end up doing different things, even though they start from the same place. Later in the week, we went over schedul...