• 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

S&B 1.5 Chapter 9, question 10

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assume the following method is properly synchronized and called from a Thread A on an Object B
wait(2000);

After calling this method, when will the Thread A become a candidate to get another turn at the CPU?

A. After object B is notified or after two seconds.
B. After the lock on B is released or after two seconde.
C. Two seconds after object B is notified
D. Two seconds after lock B is released.

A is correct: Either event will make the thread a candidate to get another turn at the CPU

Question I thought Threads were notified � not objects

Thanks
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Question I thought Threads were notified � not objects



I guess it is just a "wording" issue. Threads are notified, and I think is it safe to assume that "object B is notified" meant thread A is notified via a call to the notify() method of object B.

Henry
 
David Wooddall-Gainey
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Henry,

Thanks again. Yes I thought it was wording. Sometimes it is tricky knowing when the issue is wording vs substance!

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