linux-newbie.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jimmy Pan <dspjmt@gmail.com>
To: linux-newbie@vger.kernel.org, linux-c-programming@vger.kernel.org
Subject: How does atomic operation work on smp
Date: Thu, 8 Nov 2012 15:01:24 +0800	[thread overview]
Message-ID: <20121108070121.GA7492@gmail.com> (raw)

I understand how atomic operation work on unary core processors, I think it just disables the interrupt and dominate the cpu until it finished.
While, how do we implement this on multi processor computers?
Suppose cpu A is performing an atomic operation on variable a. At the same time, cpu B is also performing the operation on a. In such the result may be overwritten.
Of course we can use spinlocks, but on the atomic operation's behalf, how does it gurantee to prevent such case?
Can anyone explain the crux of it? Thanks.

Jimmy Pan

             reply	other threads:[~2012-11-08  7:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08  7:01 Jimmy Pan [this message]
2012-11-07 16:26 ` How does atomic operation work on smp Hendrik Visage
2012-11-07 16:45   ` Nicholas Mc Guire
2012-11-08 17:42     ` anish kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121108070121.GA7492@gmail.com \
    --to=dspjmt@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).