Education For All

Text size
  • Increase font size
  • Default font size
  • Decrease font size


Course Home

Programming Paradigms - Lecture 18

Get the Flash Player to view video.
Lecture 18 - Ice Cream Store Problem

Guest Lecturer, Setup of the Ice Cream Store Problem, with Customer, Cashier, Clerk, and Manager Threads, The Different Constraints on the Various Types of Threads, Writing the Main Function, Spawning the Various Threads, Handling the Manager-Clerk Interaction Using the Inspection Struct, Which Uses a Semaphore to Signal to the Manager That the Clerk Is Ready for Inspection, As Well as a Semaphore that Ensures that the Clerk Will Wait for the Inspection to Finish, Writing the Manager Function, Which Performs Each of the Inspections and Signals When Each one Is Finished, Writing the Clerk Function, Which Makes Cones Until the Manager Inspects and Approves One; Why an Additional Semaphore Must Be Added That Protects the Manager Function, Why Each of the Semaphores Introduced So Far Is Needed, Writing the Customer Thread's Function, Which Spawns Clerk Threads to Deliver its Ice Cream Cones and Then Waits Until They Are All Finished, Creating and Protecting the Line Struct, Which Is Used to Keep Track of the Customers Waiting for the Cashier in Order, Writing the Cashier Thread's Function, Which Checks Out Each Person Waiting in Line in Order, Waiting if Needed

Prof. Jerry Cain
CS107 Programming Paradigms
(Stanford University: Stanford Engineering Everywhere)
Date accessed: 2009-05-09
License: Creative Commons Attribution 3.0

Lecture Material

Supplementary lecture material is listed below.

1. Assignment 6
2. Assignment 6 Solutions



Chinese (Simplified) French German Italian Japanese Korean Portuguese Russian Spanish
More educational resources: