Lab 6: Applying Synchronization Primitives

Ice Cream Parlor was a lecture example created by Jerry Cain.

Before the end of lab, be sure to fill out the lab checkoff sheet here!

Before starting, get the starter code by cloning the lab6 folder:

$ git clone /usr/class/cs110/repos/lab6/shared lab6
$ cd lab6
$ make

Problem 1: Ice Cream Parlor

In this lab problem, we will implement a simulation of customers ordering ice cream in an ice cream parlor. The example is a bit contrived, but it allows us to work through a complex synchronization setup without actually having a very complicated program. You’ll see some applications of mutexes, semaphores, and condition variables that will be extremely helpful in Assignment 5.

The goal of this lab is to help you practice:

Simulation overview

This ice cream parlor comes from a somewhat odd universe:

Here are slides that walk through the various parts of the simulation: [keynote], [pdf]

Implementing the simulation

You can find the ice-cream-parlor.cc starter code in the lab6 directory (instructions for cloning are above). Alternatively, you can work through this cplayground.

Customer/Clerk interactions

Clerk/Manager interactions

Customer/Cashier interactions

Electrician/Customer interactions