• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read-write locks in SCJD?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is the distinction between a read lock and a write lock made in the SCJD? The instructions do not make any mention of a scenario where multiple clients(threads) could have multiple read locks on it, and what will happen if there are multiple read locks on a record and another client tries to obtain a write lock to modify the record?
Should the writing client wait until all read locks are dequeued? Or should the app allow dirty reads (since we won't keep track of reading locks)?
I find this a bit problematic to resolve since the SCJD instructions do not say anything about this issue of read-write locks? It just says "Lock" the record - but there's a distinction between locking for reading and locking for writing, no?
Aside of this, lock and unlock are rather trivial, can be implemented using some sort of a list structure (I havent yet thought out what data struc to use so forgive me) that would keep track of which records are locked and synchronize on that list when acquiring the lock in a familiar while()/wait()/notify() combo....
Your input is very much appreciated.
Martin
p.s. Alan Ford is not my real name, but then again I never enter my real name unless I absolutely _have_ to .
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martin (nee Alan ),
I, and a lot of others doing this exam, have decided to ignore dirty reads, as we feel it is allowed in the specifications.
Specifically in the instructions section on locking:

Note that the locking required is effectively a "write" lock only"


and in the section "Creating the user interface":

It is not necessary to provide for live updates on multiple clients when new bookings are made at other clients


Regards, Andrew
 
Martin Naskovski
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahhh, the old adage 'ignorance is bliss' applies to this case (just kidding). Well, it suits me very well then that I don't have to worry about dirty reads, because that's one less imp. detail to worry about (code), making things somewhat simpler. I assume other people have turned in submissions which do not handle dirty reads and not lost points on it....
Thank you very much,
Martin
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alan, you have to. It is out policy here to use real full names, no aliases.
Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks! and welcome to the JavaRanch!
Mark
 
Martin Naskovski
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark - I read the link, it says "By "real name", we mean either your own actual, personal name, or a name that at least looks like it could belong to a real person"
Thusly, what is wrong with Alan Ford? It is a real name if you flip the pages of a phonebook or look elsewhere I'm sure you could find this name.
I do not wish to use my real name as login name, because of google reprisals from different people, future employers etc. Is this acceptable?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll ask the gods.
Mark
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You called?
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The official policy says to use your real name or at least a name that sounds real. "Alan Ford" sounds real enough for me. But why not make it "Martin Ford" since you are signing all your posts "Martin" anyway?
 
Martin Naskovski
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Martin Ford almost makes me a descendant of our ex-pres Gerald Ford , whereas Alan Ford was a comic strip character. But I don't have a problem w/Martin Ford either .
Thanks for that quick response.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic