Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:55:44+00:00 2026-06-08T17:55:44+00:00

How does the ReentrantLock perform against synchronized for a solely uncontended lock acquisition ?

  • 0

How does the ReentrantLock perform against synchronized for a solely uncontended lock acquisition ?

Suppose you intend to implement a two lock class (which means you need 2 different locks and synchronized would not suffice, like that in LinkedBlockingQueue) where in the acquisition of put and take locks are done by say thread1 and thread 2 (always), which means the locks are uncontended and the principle of thread locality comes in, how does the ReentrantLock perform against synchronized(which would entail complete locking of the queue) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:55:45+00:00Added an answer on June 8, 2026 at 5:55 pm

    Mostly ReentrantLock wins when 3 or more threads contends, but it depends on hardware, OS, JVM version and its options.

    Martin Thompson published findings about ReentrantLock vs. synchronized block and biased locking in his blog:

    http://mechanical-sympathy.blogspot.com/2011/11/java-lock-implementations.html

    http://mechanical-sympathy.blogspot.com/2011/11/biased-locking-osr-and-benchmarking-fun.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how I can implement a single Touch Event. A simple, one
Does anyone know how I can directly access a function from a PHP class
I have two processes which I am to synchronize. Process A is running as
Can Locks (java.util.concurrent.locks.Lock) be garbage collected while locked? Suppose a purely theoretical example: WeakReference
I have code like this: public class Thingy { private final Lock lock =
Does anyone have a working, step-by-step example of how to implement IEnumerable and IEnumerator
Does anyone have any experience with the two latest revisions of Redmine? I am
Does Windows XP guarantee that a file's 'last modify' information (which can be read
Does anyone know, what an XMLHttpRequest enables a web page to do, which cannot
Does anyone know if there is a way to generate different code in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.