For those who do not know, Operating Systems - cop4600, is a computer science class geared at giving students the opportunity to learn about the core functionality of an operating system.

In this class you might be given a project (all depending on who is teaching the class at the time) to write an operating system simulator - ossim. This is a pretty lengthy project consisting of 4-5 different parts all split up into C files.

Contrary to what others might say about this project, I liked it very much since it gave me the chance to really understand linked lists in C. The fundamental idea of linked lists is simple - different nodes of data connected to each other, but stored in different, noncontiguous (not side by side) sections of memory. However, trying to implement them using pointers is definitely a chore. This project gives you a ton of practice at using linked lists in C. Maybe, it's just me, but doing these linked lists was actually fun and informative. They worked the way you'd expect them to work. When you do the project, hopefully you'll understand what I mean.

The challenging part about this project, other than the usage of pointers, is dealing with numerous source files. Thankfully, there are numerous Unix tools available to expedite the process of finding where something's located, the differences between files, and debugging your code. These tools helped me a great deal when working on this project and I hope they help you, as well with your project.

  1. Finding where something's located (grep)

    GNU Regular Expression Parser is a tool that allows you to search for text inside of files. It can display the line number (-n), the lines containing the text you searched for, & the filename where the text that you specified is found. This drastically cuts down on development time wasted by manually searching through the files.

    The following command searches all the files in your current directory for 'searchTerm' and displays the results.

       grep -in 'searchTerm' * 

  2. The differences between files (sdiff <file1> <file2>) or (vim -d <file1> <file2>)

    The 'vim -d' command (also known as vimdiff on some vim installations) and the sdiff command give you a side by side comparison of the input files you specify.

    sdiff is available by default on the version of olympus running on Solaris/SunOS. However, vim was not available by default as of when I took the class. UCF was in the process of moving olympus from the SunOS server to an Ubuntu Linux server. The Ubuntu Linux server has vim installed. :) The main reason why I know this is because I used that Ubuntu Linux server for my AI class (lisp programming).

    You can find out whether the server you're using is running SunOS or Linux by issuing the following command.

       uname -a 

    NOTE: For those who love emacs, there is supposedly a comparison tool for emacs, as well. However, I'm not sure exactly what that is since I prefer vi(m) over emacs and never looked into it.

  3. Debugging your code (gdb)

    You may be able to get away with print statements on a lot of the objectives, until you reach the last few objectives. GDB helps immensely on these objectives.

    On a side note, read about how OpenBSD developer Ray Lai learned to use GDB. It's quite comical.

For a crash course in using the Linux/Unix command line see the presentation I wrote for the LUG@UCF (Linux Users Group at UCF), here
NOTE: Unfortunately, some of the commands discussed might not be useful on UCF's server because you're a normal user (i.e. you do not have root access) and some of the commands are Linux specific. However, the majority of commands should be applicable (ls, mv, cp, grep, chmod, pwd, man, mkdir, etc...).

The version of grep on SunOS does not support recursive searches (-r).

follow me on Twitter