Education For All

www.edforall.net

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

Lectures

Course Home

Programming Paradigms - Lecture 17

Get the Flash Player to view video.
Lecture 17 - Dining Philosopher Problem, Threading

Review of the Dining Philosopher Problem, Modeling Each Philosopher as a Thread, How Deadlock Can Result, How Deadlock Can be Eliminated By Limiting the Number of Philosophers That Can Eat at Once Using a Semaphore, Using a Global Variable and a Binary Lock to Track a Resource Vs. Using a Semaphore, Another Threading Example Involving FTP Downloads of Multiple Files at Once, Where Each File Is Assigned to a Thread and the Total Number of Bytes Is Returned, Implementing a Downloadhelper Function That Downloads a File and then Uses a Binary Lock to Safely Update the Total Number of Bytes Downloaded, Ensuring that the Downloadallfiles Function Does Not Return Before All the Files Have Been Downloaded by the Threads Which It Spawns by Using a Childrendone Semaphore, Ensuring that the Downloadallfiles Function Does Not Return Before All the Files Have Been Downloaded by the Threads Which It Spawns by Using a Childrendone Semaphore, How the Childrendone Semaphore Ensures that the Function Returns at the Correct Time, No Matter How the Various Threads Are Interleaved, Setting Up the Ice Cream Store Concurrency Example for Next Week

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

Lecture Material

Supplementary lecture material is listed below.

1. More Concurrency



 

Translate

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