• 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

Locking question

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Part of the requirement of my assignment:
When a thread tries to lock a record and that record is already locked,the thread should give up the cpu and consume no more cpu cycles until the lock is available.I am still not experianced in thread programming in Java.
Any idea on how to implement this functionality??
 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Khaled,.

When a thread tries to lock a record and that record is already locked,the thread should give up the cpu and consume no more cpu cycles until the lock is available...


IMO speaking about cpu cycles at such high programming level is cleary an ambiguous requirement Sun want us to face to.
VM provides such hardware isolation that the requirement has no sense.
I decided to interpret it as:
When a thread tries to lock a record and that record is already locked, the thread should enter in a wait state and should not be notified until the lock is available.

Regards, Ori
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic