CMSC 442 -- HW 1

HW 1

Getting Started

Log onto a computer science server making sure to change the port number.

Follow these instructions to get your files ready to start lab.
  • Use wget to download the file at http://cs.longwood.edu/courses/cmsc442/f18/files/lab1.tgz
  • Uncompress the lab1.tgz file by using tar -xvzf lab1.tgz

The Problem

You are the owner of an underwater recovery company. After finding a sunken treasure of gold coins, you hire divers to recover the treasure to your vault. You know the total number of coins in the treasure and will need to track the number of coins collected by each diver.
You are to simulate this operation using c++ threads and shared variables. There will be NO synchronization. When you are done writing your simulation you will use it to expolore some questions.
  1. What is the total of the coins collected by divers?
    1. How does the total compare to the amount in the vault?
    2. How does the total compare to the starting treasure amount?
    3. Discuss.
  2. What happens as you increase or decrease the number of divers?
    1. Do divers collect the same number of coins?
    2. Do all divers collect at least one coin?
    3. Discuss.
  3. What happens as you increase or decrease the amount of treasure?

Handin

When you are done you need to hand in your lab. The easiest way is to type make handin.

If you have changed file names or directory names you will need to change to the directory which contains the directory you wish to hand in. We will use the handin cmsc442 assignment directory command. In this case you will type: handin cmsc442 lab1 lab1

You lab is due at 11:59pm Sept. 14th 2018.