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

  • Home
  • SEARCH
  • 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 8644151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:13:30+00:00 2026-06-12T12:13:30+00:00

Does anyone know the differences between the methods acquire () and release () (

  • 0

Does anyone know the differences between the methods acquire () and release () (java.util.concurrent.Semaphore) and await () and signal (new ReentrantLock().newCondition() ) .

Can you expose a pseudo code for each of these methods?

  • 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-12T12:13:32+00:00Added an answer on June 12, 2026 at 12:13 pm

    Superficially the behavior of these method might look similar – acquire()/await() can make threads block in some cirsumstances and release()/signal() can unblock threads in some circumstances. However Semaphore and Condition serve different purposes:

    • java.util.concurrent.Semaphore is relatively higher-level synchronization mechanism, intended for use by general developers. You would use it typically to restrict concurrent access to some resource by making each requester thread call acquire() before accessing the resource (that way making the thread block if no semaphore permit was available).
      Description from the javadoc:

      Conceptually, a semaphore maintains a set of permits. Each acquire() blocks if necessary until a permit is available, and then takes it. Each release() adds a permit, potentially releasing a blocking acquirer.

    • java.util.concurrent.locks.Condition is relatively low-level synchronization mechanism which basically enhances functionality provided java.lang.Object methods wait(), notify() and notifyAll(). It enables the thread to suspend its activities when it needs to wait for some condition to become true (generally through activity of other threads) and then it enables those other threads to “wake up” the waiting thread(s) when the state variables taking part in the condition might have changed. It is generally harder to use correctly and general developers are advised to use higher-level mechanisms from package java.util.concurrent (like Semaphore).

    You can find more detailed information about this in the excellent book “Java Concurrency in Practice” from Brian Goetz.

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

Sidebar

Related Questions

Does anyone know the differences between RxJs and Knockout ? To me on the
Does anyone know what substantial differences there are between the regular PostgreSQL and Postgres
Does anyone know what the difference between mmap(2) and mmap(3) is? Man section 3
Has anyone ever tested, or does anyone know, the performance differences of these two
Does anyone know the real difference between the two ways of type casting in
Looking at MyLocationOverlay - does anyone know what the difference is between: public GeoPoint
Does anyone know the difference between using VarChar(255) and VarChar(65536) ? Here's what I
Does anyone know of a definitive guide or guides that tells us the differences
Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache
Does anyone happen to know if there is any difference with regards to performance

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.