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 9186779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:36:53+00:00 2026-06-17T19:36:53+00:00

To my understanding, the AtomicReferenceArray class allows the individual elements to be updated atomically.

  • 0

To my understanding, the AtomicReferenceArray class allows the individual elements to be updated atomically. This would make the collection thread-safe. Concurrent collections employ various algorithms to allow the collection to be thread-safe, but also non-blocking. I understand that some of the collection classes provide convenient methods, like add(...), or certain functionality like queuing. But ignoring that, and focusing solely on adding and retrieving elements, is there a reason to use one of the concurrent collections rather than an AtomicReferenceArray?

Also, what about performance?

  • 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-17T19:36:54+00:00Added an answer on June 17, 2026 at 7:36 pm

    is there a reason to use one of the concurrent collections rather than an AtomicReferenceArray?

    Yes, if you need a dynamically sized collection. The AtomicReferenceArray allows you to atomically get and set elements in the array but you cannot grow the size of the array.

    Two threads can reliably change the same element in an AtomicReferenceArray with compareAndSet(...) and other methods, but they can’t just add data to the array like you can a collection. Using an AtomicReferenceArray is useful if, for example, each thread has a unique ID and they are updating their personal value in the array. But this would not work if you have two producers who want to add a job to a work list.

    Lastly, the complexity of the AtomicReferenceArray is much less than a true concurrent collection. Concurrent collections allow iterators, deletes, adds, etc. to happen concurrently, safely. The AtomicReferenceArray class allows test and set spin loops and other functionality but is not a good replacement for a full blown collection.

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

Sidebar

Related Questions

Understanding question: 1.) X_IndexViewModel class public class X_IndexViewModel { public List<SelectListItem> CheckBox_1 { get;
My understanding is that C++ allows static const members to be defined inside a
My understanding is that using set.seed ensures reproducibility but this is not the case
My understanding of col is that it may be used to indicate a class
My understanding is that each new thread in .Net allocates 1MB of stack space
My understanding was that the regexp form a{m,n} would match a at most n
My understanding of this is that a synchronized block keeps other threads from accessing
My understanding to par is that it will create a thread in another core
My understanding of Dart leads me to believe that this 'cast' should not affect
My understanding of this is as follows. In C, the ! operator returns 0

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.