Posts

Learning Journal - Week 33

Overview We are now on Week 7 of my studies at CST-334, which looks to be my final module barring the Final Exam. In addition to recapping the final week, I also want to take a moment and begin by reflecting back on the course overall. Going into the course, back when I first saw the name of the course was 'Operating Systems', I must be honest and say that I was expecting a course focused on navigating Linux as an operating system, learning shell commands, and how to interface with the Operating System. What I learned instead, however, ended being way more intriguing than what I was originally anticipating. While we didn't necessarily tackle the user-oriented side of operating systems that I was expecting, I ended up with a new-found appreciation and deep understanding of the kernel, memory management, process scheduling, and I/O interfacing that operates under the hood.  Something else that I wasn't expecting was that learning about how kernels power our machines expla...

Learning Journal - Week 32

During this past week in CST-334, we continued talking about thread locks and we explored condition variables, got introduced to semaphores and flagging, and dove into some common concurrency problems.  Recap  We begin by digging into condition variables. They aim to solve one of the biggest problems of "spinning", which is wasting thread efficiency. The naive approach for waiting on a thread to be finished is by simply creating a global flag variable (int done = 0 or = 1 for example), and performing a while loop until done is set to 1. The downside of this approach being that having the thread constantly check this is wasted time and checks, so it'd be much more efficient to simply notify the thread when it's ready to proceed.  Condition variables  are the solution: they can  signal  and notify waiting threads that a processed has completed and a thread has freed, or they can be used to initiate a wait on a thread. We were also introduced to the Anderson/D...

Learning Journal - Week 31

 This past week from CST-334 focused on understanding threads and locks. As someone who was self-taught C++ as a first programming language, threads were something I stumbled across but never got to fully understand. Now learning about how threads work in the context of Operating Systems, it's a lot easier to digest and I feel much more comfortable using and understanding threads. Recap  Something we learned off the bat was that processes, in the way we've been understanding them up to this point, are essentially threads. A thread is a run of execution, and the operating system splits up time segments for these threads in the scheduling we've been used to seeing. Every process has at least one thread, and more threads can be created manually in a program like C to take better advantage of multi-programming. This means that within a specific program, we can create a separate thread to essentially run "at the same time" as other parts of our program which could help...

Learning Journal - Week 30

From this past week in CST-334, we spent more time focusing on virtual memory and translations. It helped to solidify my understanding of concepts like paging from last week, and elaborated on concepts like Memory Allocation in C.   Recap  One of the first things we went over was free space management, which focuses specifically on how C functions like  malloc()  and  free()  work under the hood: the operating system tracks a large block of all the free space, and as memory-allocation is called then a header is set at the beginning position tracking how much space it takes up. The chunks of free space separated by chunks of allocated space ends up in a data structure called the  free list , which keeps track of the starting address of the unallocated memory and its size (how many bytes it has available adjacent to it). When the allocation function is called, it can either grab from the free region it finds first ( first fit ), from the region with the ...

Learning Journal - Week 29

 From this past week in CST-334, we spent some time learning about how memory in managed in the operating system, and specifically about the concept of Virtual Memory. I learned that the operating system doesn't let programs directly access real physical memory, but rather only a virtual slot of memory, and then the Memory Management Unit built in the CPU translates the virtual memory address into a real memory address. With the concept of memory in mind, we also went over how the C programming language gives us tools to interact with memory using functions like malloc()  to manually allocate memory and  free()  to manually designate memory as freed. We also spent time investigating deeper into how the MMU actually translates virtual memory into physical memory using processes like  Base and Bounds  which denotes the start point of an address and how much space it can cover, as well as the strategy of  Segmentation  which splits up the memory into...

Learning Journal - Week 28

 In the past week, I've learned a lot of new interesting topics that relate to Operating Systems. We're now digging into the specifics of how the Operating System interacts with different processes. We went over how a program -- which is really just a string of data -- is only made useful by the operating system, which can turn it into a running program, called a process. There isn't only one process, however, and the operating system is responsible for ensuring that every process (including the Operating System) is given adequate time to run. We went over the concept of multi-programming, which is the strategy used to make running programs appear concurrent, especially on a device that can only technically process one thing at a time. We learned about concepts like yielding and switching to move from one process to another and how to emulate this in the C programming language, as well as how policies are introduced to enforce how much time each process gets, such as First ...

Learning Journal - Week 27

 During this past week of CST334, there was a few new topics I was excited to dive into. The lectures covered specifically: A brief introduction of operating systems How an operating system chooses to allocate resources for all of its programs, what is important to it (such as protecting certain files and also giving the user an easy-to-use interface), and how a computer's resources are managed by the operating system.  Computer Architecture  Discussing the core components of a computer, such as the central processor and memory, as well as going over the hierarchy of computer storage (registers, cache, main memory, etc.). This lecture connects a computer's hardware to software and how the two interact in a low-level.  Linux and Shell A history and overview of the Unix operating system, as well as its derivatives like GNU/Linux and OSX (MacOS). This lecture also briefs over how an operating system splits permissions, such as User modes and Kernel modes, for inter...