[gclist] synchronization cost (was: Garbage collection and XML)
Ji-Yong D. Chung
virtualcyber@erols.com
Sat, 10 Mar 2001 16:55:16 -0500
Hi,
I am embarassed to admit that, on my prev.
posting, I should have checked my facts before commenting
on spin locks and XCHG.
After seeing Boehm's email, I ran tests on XCHG,
and I am getting slightly worse results, at about
22 instruction cycles for each XCHG.
I have run the tests on Pentium II (200 MHZ),
WindowsNT4.0, SP4. The test is compiled using VC++6.
The test has to be run multiple times either
with a VC++6.0 profiler or with a timer,
and with minimum no of processes on the
host machine.
||======================================
|| Here is my code for running the test
#include <iostream.h>
#include <time.h>
#include <sys/timeb.h>
void main()
{
struct _timeb begin, end;
int locker = 0;
int* lock_addr = &locker;
_ftime(&begin);
__asm
{
mov ebx, [lock_addr]
mov ecx, 10000000
RETRY:
mov edx, ebx
mov eax, 1
xchg eax, [edx] // Here is the XCHG
dec ecx
jnz RETRY
};
_ftime(&end);
cout << (end.time - begin.time) * 1000 + end.millitm - begin.millitm <<
endl;
};