Take a look at the lmbench Linux benchmark suite.
Phil
--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt
> __declspec(naked)
> DWORD __stdcall CmpXchgAtomic32( DWORD volatile *pdwWhere, DWORD
> dwComparand, DWORD dwNew )
> {
> __asm
> {
> mov edx, [esp + 4 + 0] // pdwWhere
> mov eax, [esp + 4 + 4] // dwComparand
> mov ecx, [esp + 4 + 8] // dwNew
> cmpxchg [edx], ecx
> ret (4 + 4 + 4)
> }
> }
[...]
If the CMPXCHG instruction above happens to be executed concurrently by two
or more threads, that are not bound to the same processor, then should you
not have the LOCK prefix? IIRC, XCHG is the only instruction that asserts
the LOCK implicitly...
Are you trying to piss me off or something?
> Of cours these operations are
> performed on the same CPU and I'm pretty sure you discovered that yourself
> when you read the code.
[...]
Yes I did.
[...]
The code I post in USENET is mostly pseudo-code sketches of algorithms I am
thinking about. I type this code out in the newsreader:
http://groups.google.com/group/comp.programming.threads/msg/785ffb9cd422533c
If you want to see some actual source code look here:
http://appcore.home.comcast.net
> and your self-corrections in follow-ups to
> your own postings speak a strong language; i.e. I'm pretty sute you
> have a subcortical mental disporder of this kind.
Posting corrections brings you to the conclusion of a mental disorder? I
feel sorry for your patients! Ouch.
> I'm pretty sure multithreading is a obsession for you because you miss
> the feeling of control in your mind. It's a counter-phobic behaviour to
> your uncertainness.
I love multi-threading.
>> and your self-corrections in follow-ups to
>> your own postings speak a strong language; i.e. I'm pretty sute you
>> have a subcortical mental disporder of this kind.
>Posting corrections brings you to the conclusion of a mental disorder? I
>feel sorry for your patients! Ouch.
Trolls don't have patience.
What is the scheduler bug that requires you to sleep 20 ms? Also, you
say it takes about 7700 cycles for a context switch, how much time in
seconds is that? I, too, am trying to figure out how much time it
takes to perform a thread and process switch in windows xp.
wk