public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Atomic operations
Date: 3 Jun 2002 11:43:07 -0700	[thread overview]
Message-ID: <adgdbr$1nj$1@cesium.transmeta.com> (raw)
In-Reply-To: <EE83E551E08D1D43AD52D50B9F5110927E7A15@ntserver2>

Followup to:  <EE83E551E08D1D43AD52D50B9F5110927E7A15@ntserver2>
By author:    Gregory Giguashvili <Gregoryg@ParadigmGeo.com>
In newsgroup: linux.dev.kernel
> 
> Could you, please, clarify what you meant saying that there was no way of
> doing so. I admit, I'm no expert in i386 assembly, but this operation seems
> so simple to me...
> 

That doesn't mean the hardware is going to provide it atomically.

> 
> Could you, please, suggest some other implementation (with waiting and
> trying again - whatever this means)?
> 

Very simple:

- Set a spinlock (note: you need a spinlock variable)
- Read
- Add
- Clear spinlock

This is called "bootstrapping" -- using a more primitive atomic
operation to get what you need.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

  reply	other threads:[~2002-06-03 18:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-03 19:09 Atomic operations Gregory Giguashvili
2002-06-03 18:43 ` H. Peter Anvin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-06-04  9:23 Gregory Giguashvili
2002-06-03 15:58 Gregory Giguashvili
2002-06-03 15:04 Gregory Giguashvili
2002-06-03 17:27 ` H. Peter Anvin
2002-06-03 18:08 ` Richard B. Johnson
2002-06-03 19:36   ` Thunder from the hill
2002-06-03 21:30     ` Richard B. Johnson
2002-06-03 18:39 ` Brian Gerst
2002-06-03 19:49   ` H. Peter Anvin

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='adgdbr$1nj$1@cesium.transmeta.com' \
    --to=hpa@zytor.com \
    --cc=linux-kernel@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