[SDL] Re: threading overhead

Pierre Phaneuf pp at ludusdesign.com
Sun Apr 9 18:25:18 PDT 2000

Mattias Engdegård wrote:

> for Solaris 2.6, gcc without optimization. Oh, yes, I filled your malloc()ed
> buffers just to be sure that we don't memcpy() from a single COW zero page,
> but it didn't really change the results.

Freshly malloc()ed memory sometimes is not actually allocated, but this
is slightly different from COW, any access (including reading) to the
page will do the actual allocation, right?

> > I was expecting this, but I was wondering if any multithreading
> > proponent had anything to say on my code?
> I'm not a MT proponent (rather the opposite), but your code is quite
> sensitive to cache sizes, not only the thread implementation. I'm
> somewhat amazed that cache misses + kernel overhead eats as much
> as 0.5ms per iteration though.

As for the cache sizes, that's why I made the buffer size modifiable.
BTW, I specifically wanted cache misses to happen, as to simulate
unrelated threads breaking the cache for each other, but they have the
destination buffer in common, to simulate locking interaction.

My impression is that for a game, it is cache misses that are biggest
lose, as they mess up things like culling, blitting and mixing.

Pierre Phaneuf

More information about the SDL mailing list