linux-smp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mutex vs cache coherency protocol
@ 2007-09-03 18:03 Xu Yang
  2007-09-03 21:44 ` Robert M. Hyatt
  2007-09-03 22:54 ` Mohamed Bamakhrama
  0 siblings, 2 replies; 7+ messages in thread
From: Xu Yang @ 2007-09-03 18:03 UTC (permalink / raw)
  To: linux-smp

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.

regards,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mutex vs cache coherency protocol
  2007-09-03 18:03 mutex vs cache coherency protocol Xu Yang
@ 2007-09-03 21:44 ` Robert M. Hyatt
  2007-09-03 22:56   ` cerise
  2007-09-04  8:58   ` Xu Yang
  2007-09-03 22:54 ` Mohamed Bamakhrama
  1 sibling, 2 replies; 7+ messages in thread
From: Robert M. Hyatt @ 2007-09-03 21:44 UTC (permalink / raw)
  To: Xu Yang; +Cc: linux-smp


what about the kernel?  How will it protect itself when multiple 
processors execute kernel code???


Robert M. Hyatt, Ph.D.          Computer and Information Sciences
hyatt@uab.edu                   University of Alabama at Birmingham
(205) 934-2213                  136A Campbell Hall
(205) 934-5473 FAX              Birmingham, AL 35294-1170

On Mon, 3 Sep 2007, 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.
> 
> regards,
> -
> To unsubscribe from this list: send the line "unsubscribe linux-smp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mutex vs cache coherency protocol
  2007-09-03 18:03 mutex vs cache coherency protocol Xu Yang
  2007-09-03 21:44 ` Robert M. Hyatt
@ 2007-09-03 22:54 ` Mohamed Bamakhrama
  2007-09-04  8:59   ` Xu Yang
  1 sibling, 1 reply; 7+ messages in thread
From: Mohamed Bamakhrama @ 2007-09-03 22:54 UTC (permalink / raw)
  To: Xu Yang; +Cc: linux-smp

On 9/3/07, Xu Yang <risingsunxy@googlemail.com> 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.
>

Hi,
I advice you to read the following book:
"UNIX systems for modern architectures: symmetric multiprocessing and
caching for kernel programmers"
C Schimmel - 1994 - Addison-Wesley Longman Publishing Co., Inc. Boston, MA, USA

Best regards,

-- 
Mohamed

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mutex vs cache coherency protocol
  2007-09-03 21:44 ` Robert M. Hyatt
@ 2007-09-03 22:56   ` cerise
  2007-09-04  8:58   ` Xu Yang
  1 sibling, 0 replies; 7+ messages in thread
From: cerise @ 2007-09-03 22:56 UTC (permalink / raw)
  To: linux-smp

Exactly -- cache coherency ensures that things are only modified once by a
series of processors, but it doesn't ensure that a given, necessarily atomic
sequence of operations is executed by only a single thread of operation.

I'm not entirely sure a kernel couldn't be built using only cache coherency
to prevent deadlocks.  Something like a delegate system where you queue up
requests through a single operation seems like it would do, but ultimately,
you're just making a complicated mutex at that point.

-Phil/CERisE

On Mon, Sep 03, 2007 at 04:44:56PM -0500, Robert M. Hyatt wrote:
> 
> what about the kernel?  How will it protect itself when multiple 
> processors execute kernel code???
> 
> 
> Robert M. Hyatt, Ph.D.          Computer and Information Sciences
> hyatt@uab.edu                   University of Alabama at Birmingham
> (205) 934-2213                  136A Campbell Hall
> (205) 934-5473 FAX              Birmingham, AL 35294-1170
> 
> On Mon, 3 Sep 2007, 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.
> > 
> > regards,
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-smp" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-smp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mutex vs cache coherency protocol
  2007-09-03 21:44 ` Robert M. Hyatt
  2007-09-03 22:56   ` cerise
@ 2007-09-04  8:58   ` Xu Yang
  2007-09-04 17:26     ` Robert M. Hyatt
  1 sibling, 1 reply; 7+ messages in thread
From: Xu Yang @ 2007-09-04  8:58 UTC (permalink / raw)
  To: Robert M. Hyatt; +Cc: linux-smp

Hi Robert,

could you explain more about it, I am quite interested in this.

thanks,

regards,

Yang


2007/9/3, Robert M. Hyatt <hyatt@cis.uab.edu>:
>
> what about the kernel?  How will it protect itself when multiple
> processors execute kernel code???
>
>
> Robert M. Hyatt, Ph.D.          Computer and Information Sciences
> hyatt@uab.edu                   University of Alabama at Birmingham
> (205) 934-2213                  136A Campbell Hall
> (205) 934-5473 FAX              Birmingham, AL 35294-1170
>
> On Mon, 3 Sep 2007, 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.
> >
> > regards,
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-smp" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mutex vs cache coherency protocol
  2007-09-03 22:54 ` Mohamed Bamakhrama
@ 2007-09-04  8:59   ` Xu Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Xu Yang @ 2007-09-04  8:59 UTC (permalink / raw)
  To: bamakhrama; +Cc: linux-smp

Hi Mohanmed,

thanks for you recommand, I have ordered this book.


2007/9/4, Mohamed Bamakhrama <bamakhrama@gmail.com>:
> On 9/3/07, Xu Yang <risingsunxy@googlemail.com> 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.
> >
>
> Hi,
> I advice you to read the following book:
> "UNIX systems for modern architectures: symmetric multiprocessing and
> caching for kernel programmers"
> C Schimmel - 1994 - Addison-Wesley Longman Publishing Co., Inc. Boston, MA, USA
>
> Best regards,
>
> --
> Mohamed
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mutex vs cache coherency protocol
  2007-09-04  8:58   ` Xu Yang
@ 2007-09-04 17:26     ` Robert M. Hyatt
  0 siblings, 0 replies; 7+ messages in thread
From: Robert M. Hyatt @ 2007-09-04 17:26 UTC (permalink / raw)
  To: Xu Yang; +Cc: linux-smp

the kernel executes code on behalf of users all the time.  For example, 
to queue up I/O requests, to read files, to handle network connections, 
to allocate/free memory, to send signals, and a zillion other things.  
Many of these operations require modification of something called "a 
serially-reusable resource" which is just a fancy name for something 
that can only be used by one user at a time.  A stall in a men's 
restroom is an example.  Or, in this case, perhaps it is just a simple 
linked list.  If two processors were to try to insert or remove (or a 
combination of both) things on a list at the same time, race conditions 
can arise and the data can become unusable.  So we use a spinlock to 
prevent multiple processors from modifying the same data structure at 
the same time...



Robert M. Hyatt, Ph.D.          Computer and Information Sciences
hyatt@uab.edu                   University of Alabama at Birmingham
(205) 934-2213                  136A Campbell Hall
(205) 934-5473 FAX              Birmingham, AL 35294-1170

On Tue, 4 Sep 2007, Xu Yang wrote:

> Hi Robert,
> 
> could you explain more about it, I am quite interested in this.
> 
> thanks,
> 
> regards,
> 
> Yang
> 
> 
> 2007/9/3, Robert M. Hyatt <hyatt@cis.uab.edu>:
> >
> > what about the kernel?  How will it protect itself when multiple
> > processors execute kernel code???
> >
> >
> > Robert M. Hyatt, Ph.D.          Computer and Information Sciences
> > hyatt@uab.edu                   University of Alabama at Birmingham
> > (205) 934-2213                  136A Campbell Hall
> > (205) 934-5473 FAX              Birmingham, AL 35294-1170
> >
> > On Mon, 3 Sep 2007, 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.
> > >
> > > regards,
> > > -
> > > To unsubscribe from this list: send the line "unsubscribe linux-smp" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > >
> >
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-09-04 17:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-03 18:03 mutex vs cache coherency protocol Xu Yang
2007-09-03 21:44 ` Robert M. Hyatt
2007-09-03 22:56   ` cerise
2007-09-04  8:58   ` Xu Yang
2007-09-04 17:26     ` Robert M. Hyatt
2007-09-03 22:54 ` Mohamed Bamakhrama
2007-09-04  8:59   ` Xu Yang

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 NNTP newsgroup(s).