Week 4 Operating Systems

Feb 2, 2019 08:43 · 288 words · 2 minute read

When I started the OMSCS (Online Masters of Computer Sciecne) program about a month a go, I had plans on frequently maintaining this blog, posting daily or at least a couple times a week.

But nope.

It’s been about 4 weeks since my last post because with the current workload — reading whitepapers and programming in C and watching lectures — I’ve had zero spare time to just sit down and pour my thoughts out. But fortunately, I’ve completed the first programming project assignment (which consists of four parts, each assignment building on top of one another in order to prepare us to write a multi-threaded client and multi-threaded web server that implements a ficitious GETFILE protocol) and have a few cycles to spare to share what I’ve learned before.

Over the past four weeks, I’ve learned the following:

  • How to use sockets in C to write a client that tranfers messages over TCP
  • How to use sockets in C to write a webserver that that responds to requests over TCP
  • The importance of zeroing out memory allocated on the stack (or heap)
  • The importance of freeing heap allocated memory to avoid leaks
  • How to use mutexes to lock access to shared resources
  • Null termination (or lack thereof) in arrays of characters (i.e. strings in C)
  • How to use conditionals (in combination with mutexes) to coordinate threads
  • How to avoid deadlocks when writing concurrent programs using threads
  • Thread design patterns (e.g. boss, pipeline)
  • The advantages and disadvantages of forking to create a process when compared when with creating threads
  • Why and how to use function pointers and callbacks (in C)
  • Using pread() over read() for writing thread safe applications
  • Using dup to open up a new file descriptor