• 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

Synchronization --mutex on 2 objects

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From Sierra/Bates:


"Synchronization can prevent two objects from being accessed by the same thread.


T/F?
Answer: F.
Why false? is is so hard to imagine an object that has two objects?

(edit post note: when editing this and other posts, some text got deleted by the forum)
[ March 30, 2003: Message edited by: Garrett Smith ]
[ March 30, 2003: Message edited by: Garrett Smith ]
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compare these two sentences
Synchronization can prevent two objects from being accessed by the same thread.
Synchronization can prevent an object from being accessed by the two threads.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy Garrett, yes Marlene pointed out exactly what we were contrasting the question with (two objects and one thread vs. two threads and one object).
Java synchronization is not designed to prevent a single thread from accessing two objects, since any thread can access an object as long as it gets the lock (mutex). But I have to say I'm not exactly in love with our wording on this question. Just too many ways you could conceivably look at it, and you probably found one that wasn't what we intended.
I'm hoping Marlene's post brought up our intended perspective
And good luck, I understand you're taking the exam very soon.
cheers,
Kathy
 
reply
    Bookmark Topic Watch Topic
  • New Topic