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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:39:13+00:00 2026-05-18T11:39:13+00:00

I read one article, describing the ABA problem, but there is something, that I

  • 0

I read one article, describing the ABA problem, but there is something, that I can’t understand. I have source code, which fails to work and it is similar to the example in article, but I don’t understand the problem. Here is the article

http://fara.cs.uni-potsdam.de/~jsg/nucleus/index.php?itemid=6

It says: While the actual value of head_ is the same (a) the next_ pointer is NOT

But how can it be? If two structure objects

struct node {
   node *next;
   data_type data;
};

“head_” and “current” point to the same area in memory, how can head_->next and current->next point to different?

It also says: The last operation, the compare-and-swap by foo SUCCEEDS when it should not.

Then what should it do? Load the same address and try again? What is the difference?

Currently in my code I have similar situation, where I do CompareAndSwap on the object, which might be changed by another thread to the object with similar address

deleted.compare_exchange_strong(head, 0);

but if changed object is well initialized and it’s next pointer contain pointer to initialized object then what is the problem?

Thanks in advance.

  • 1 1 Answer
  • 3 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-05-18T11:39:14+00:00Added an answer on May 18, 2026 at 11:39 am

    "head_" and "current" point to the same area in memory, how can head_->next and current->next point to different?

    They do not; but the code needs that both head and head->next are stable while the pop method runs – but the CAS only ensures this for head. It silently assumes head->next won’t changed without changing head, which is false. So it reads something as current->next and a while later, it changes.

    It also says: The last operation, the compare-and-swap by foo SUCCEEDS when it should not.

    Then what should it do? Load the same address and try again? What is the difference?

    Yes. The method needs to wait (or keep trying) until noone messes with the structure under its hands.

    but if changed object is well initialized and it’s next pointer contain pointer to initialized object then what is the problem?

    Could be anything. Violations of classes’ invariants, double frees/memory leaks, losses of data etc.

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

Sidebar

Related Questions

I think I might have read every usort article on StackOverflow, but I can't
I read the Wikipedia article about md5 hashes but I still can't understand how
I've read all recommended articles on SynchronizationContext, but there is one small question I
Hey there. I've read all the related articles on here and can't find one
I am working with WCF .NET 3.5 SP1 and have read that one does
I had read somewhere about one specific feature that is present in awk but
I have read many article about this one. I want to hear from you.
I am new to C#. Recently I have read an article.It suggests One of
i have read this article from dev.mysql . in that page is a example
I have been doing some reading lately one article I read was from Opera.

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.