[cs33211] Re: Project1 part 2.

Mikhail Nesterenko mikhail at cs.kent.edu
Mon Mar 9 17:29:50 EDT 2009


I suggest you spend a day or two making sure the code works
correctly. The grading would be such that a correct assignment
submitted a day or two late would get more credit than an incorrect
project submitted on time. 

Condition variable allows the thread to give up the lock while it is
holding it. The code for the second assignment could be as
follows. One single lock around the decision portion of the code. If a
thread gets the lock and (inside) determines that it cannot enter the
CS (for example this is the pedestrian thread and there are cars
there) then it could sleep on the condition variable, thus giving up
the lock and allowing cars to get out of the construction zone.

Carefully study the readers/writers solution with locks and condition
variables that we covered in class. It should give you an idea a to
how to implement the second part of the project. 


Thanks,
--
Mikhail


> I've been trying to get my program to work properly, and I believe I just
> don't understand how the pthread_cond_t class objects work, or perhaps I
> simply set my code up incorrectly to support them.

...

> I don't know if you'll get this in time, but I was wondering whether it
> would be better for me to turn in the assignment tonight with an explanation
> of why it's wrong and how it could be made right? or Should I wait and get
> help from you in person and turn it in Late for partial credit?

...


More information about the cs33211 mailing list