Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Lecture 18 | Programming Paradigms (Stanford)

Loading...

Sign in or sign up now!
12,904
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 18, 2008

Lecture by Professor Jerry Cain for Programming Paradigms (CS107) in the Stanford University Computer Science department. In this lecture, Prof. Cain discusses the synchronization directive by using the ice cream store simulation as an example.

Programming Paradigms (CS107) introduces several programming languages, including C, Assembly, C++, Concurrent Programming, Scheme, and Python. The class aims to teach students how to write code for each of these individual languages and to understand the programming paradigms behind these languages.

Complete Playlist for the Course:
http://www.youtube.com/view_play_list?p=9D558D49CA734A02

CS 107 Course Website:
http://www.CS107.stanford.edu/

Stanford University:
http://www.stanford.edu/

Stanford University Channel on YouTube:
http://www.youtube.com/stanford/

Category:

Education

Tags:

Download this video

LICENSE: Creative Commons (Attribution-Noncommercial-No Derivative Works).

For more information about this license, please read: http://creativecommons.org/licenses/by-nc-nd/3.0/.

High-quality MP4 Learn more

  • likes, 1 dislikes

Link to this comment:

Share to:

Top Comments

  • The TA does the "make sense?" thing too! He has a bright future!

  • This guy is not so good as Jerry is ,but he is still good :)

see all

All Comments (7)

Sign In or Sign Up now to post a comment!
  • Actually, regarding this question, the guy is right, you could do everything with the lock. The clerk locks the thread, and the supervisor checks the cone and returns unlocking the semaphore. If there was a problem (Cone disapproved) then the clerk can go back to the queue. With the scheme proposed by the lecturer, the clerk makes kind of busy wait (not really busy wait, but like it), taking the supervisor and not releasing it until he approves the cone. He basically hijacks the supervisor!

  • @alililiff Sorry for replying to an old post, but you're wrong. Requested is the exact opposite of lock and is therefor needed. The manager needs to start working when the lock turns 0, but you can't test for that in this implementation. You can only make the manager wait for a semaphore to be higher then 0. To go without "requested" you would need a semaphore wait function that waited untill a semaphore became non-zero and then did nothing to the semaphore.

  • the question @ about 30.00 is right becouse if the lock is 1 so its opened it cant be 2 so no 2 clerks can be in the office at the same time so basically requested is the same is lock and requested isnt needed.

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more