Hi Shan,
the instruction says "at most one program is accessing the database file"
I dont have anything like this in my assignment - is this the new assignment?
The system associates a unique lock with EVERY instance of ...
Just to be clear here (or attempt to anyway
). The system associates a unique lock with each and every instance of ....
So, using the CubbyHole example:
ch1 has a unique lock, as does ch2, as does ch3. This is 3 locks, not 1 unique lock against all instances.
So when you call ch1.put() c1's lock is invoked, and no other thread can call ch1.get(). However ch2 has a seperate unique lock, so any thread could call ch2.get() or ch2.put().
Regards, Andrew