CS3331 Reading List: Week 13

Course Material
Channel slides used in class are available in the common directory with filename 12-Channels.pdf.
Study the channel section of Multithreaded Programming with ThreadMentor: A Tutorial
  • If you wish to install ThreadMentor on your home machine, the common directory has three files: ThreadMentor-Fedora.tar.gz for Linux 32-bit, ThreadMentor-Linux64.tar.gz for Linux 64-bit, and ThreadMentor-Win32-VSNet2005.zip. Sorry, there is no Mac version.
  • If you wish to print these slides, print them double-sided and print as many slides as possible on the same page. Let us save a tree!

    Programming Material
    Do Programming Assignment VI.

    Homework Assignment
    Do the following:
    • We mentioned in class that if resources are ordered in a hierarchical way so that thread acquire resources always follow this ordering, there is no deadlock. Prove this claim rigorously.
    • Consider a system consisting of four identical copies resources shared by three processes, each of which needs at most two resources. Prove rigorously that the system is deadlock free.
    • Play with ThreadMentor's channel visualization features and learn the meaning of the following:
      • The Channel button in the History Graph window.
      • The Channel menu button in the main window.
      • The meaning of tags CB, CA, CS and CR.
      • Study the two sample channel programs on ThreadMentor page.
    • We mentioned in class that for the shared memory model semaphores, monitors and channels are all equivalent to each other. In other word, each of these three can be implement by the other. You were also asked as an exercise previously to implement a semaphore using a monitor, and learned (in one of our reading lists) that semaphores can be used to implement a Hoare monitor. Now you should be able to do the following:
      1. Implement a semaphore using channel(s).
      2. Implement a synchronous channel using semaphores.
      3. Implement an asynchronous channel with bounded capacity using semaphores.
      4. Implement a synchronous channel using a monitor.
      5. Implement an asynchronous channel with bounded capacity using a monitor.
      Consequently, you learn the equivalence among these three commonly seen synchronization mechanisms.
We do not collect your practice work; but, similar problems will appear in quizzes and exams in the future. Note that I will not make any announcement in class for these short quizzes. In other word, short quizzes may take place at any time as long as I see it is appropriate.