lkml.org 
[lkml]   [1999]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Shared memory not SMP safe to user-mode code.
Date
From
> The following program shows that shared memory is not SMP safe.
> It is my understanding that, from the user's code point-of-view,
> the fact that a machine may have two (or more) processors should
> be invisible.

Not entirely.

> It appears as though, on a SMP machine, shared memory is not the same
> page shared amongst tasks. It appears (emphasis upon appears) as though
> shared-memory is a copy of something that does not get updated properly
> after a write (like it's in one CPU's cache, but not in another). I
> think one has to invalidate the cache after a write to shared memory??

Your code is broken.

> #define cli __asm__ __volatile__("cli\n")
> #define sti __asm__ __volatile__("sti\n")

These only affect the local CPU

> while((key = pars->key++) == 0)

This isnt SMP safe

> pars->spin += key;

This isnt SMP safe etc..



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.060 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site