One of my required classes this semester was CS 311: Operating Systems. Binghamton University replaced CS 350 with CS 311 this semester – its identical except without the required Lab time; rather, we’re required to complete all of the labs on our own time.
The first lab required us to read from a text file, and create an identical copy of it. There were two versions – one that read/wrote character by character, and one that read/wrote line by line. In either version, the original file was read, then the text was written to the output file. Both CPU Time and Wall Time were calculated to check how the scheduler differed between Windows and Redhat Linux.
Lab 2 required us to perform matrix multiplication concurrently using threads. The matrices were read in from a single file, with the two matrices being divided by a line of stars ['*'], and stored in a vector-of-vectors [vector< vector
Sample Output File:
In Lab 3, we revisited the old Readers/Writers concurrency problem. Rather than using semaphores, as most solutions for this problem do, we were required to use a monitor to provide the synchronization to the threads. The user supplied the program with the necessary parameters via the command, and then was given the option of 3 different modes of operation – 1) Readers have absolute priority, 2) Writers have absolute priority, and 3) the threads are treated on a First Come, First Served basis. For each mode, different logic was used within the monitor to enforce the appropriate conditions for the threads. Every time a Writer was executed, a Database string was updated with the current time of day in the format HH:MM:SS:mmm. Every time a Reader was executed, the Database was read. Each thread wrote a line to an output text file when it executed, allowing the user to see the order in which the threads were run.
Sample Output File:
These are just the first three labs that were coded for this class; please check back as the class continues and I update with the remainder of the labs we code.