All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Snook <csnook@redhat.com>
To: Xu Yang <risingsunxy@googlemail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: mutex vs cache coherency protocol(for multiprocessor )
Date: Tue, 04 Sep 2007 08:59:41 -0400	[thread overview]
Message-ID: <46DD56BD.2070902@redhat.com> (raw)
In-Reply-To: <ab40e9c0709031057y195467c7y63f74b753218b618@mail.gmail.com>

Xu Yang wrote:
> Hello everyone,
> 
> Just got a rough question in my head.
> 
> don't know whether anyone interested .
> 
> mutex vs cache coherency protocol(for multiprocessor)
> 
> both of these two can be used to protect shared resource in the memory.
> 
> are both of them necessary?
> 
> for example:
> 
> in a multiprocessor system, if there is only mutex no cache coherency.
> obviously this would cause problem.
> 
> what about there is no mutex mechanism, only cache coherency protocol
> in multiprocessor system? after consideration, I found this also could
> casue problem, when the processors are multithreading processors,
> which means more than one threads can be running on one processor. in
> this case if we only have cache coherency and no mutex, this would
> cause problem. because all the threads running on one processor share
> one cache, the cache coherency protocol can not be functioning
> anymore. the shrared resource could be crashed by different threads.
> 
> then if all the processors in the multiprocessor system are sigle
> thread processor, only one thread can be running one one processor. is
> it ok, if we only have cache coherency protocol ,no mutex mechanism?
> 
> anyone has any idea? all the comments are welcome and appreciated,
> including criticism.

Cache coherency is necessary for SMP locking primitives (and thus Linux SMP 
support), but it is hardly sufficient.  Take a look at all the exciting inline 
assembly in include/asm/ for spinlocks, atomic operations, etc.

	-- Chris

      reply	other threads:[~2007-09-04 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-03 17:57 mutex vs cache coherency protocol(for multiprocessor ) Xu Yang
2007-09-04 12:59 ` Chris Snook [this message]

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=46DD56BD.2070902@redhat.com \
    --to=csnook@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=risingsunxy@googlemail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.