[clean-list] Clean Wish List: My old major wish...

Marco Kesseler m.wittebrood@mailbox.kun.nl
Fri, 11 Oct 2002 12:18:01 +0200


>	I have seen mention that there turned out to be some trouble with 
>	getting this sort of stuff running efficiently on Intel processors, 
>	but I somehow doubt this, because I believe the Pentium has some low 
>	level locking mechanisms. I could be wrong though.
>	
>In another mailing list, I have heard that the Pentium locking instructions
>are horrendously expensive.  But I don't have that of my own knowledge.

I am no Pentium expert either, but someone told me that it also has 
intructions for atomically exchanging the contents of a register with 
that of a memory location. These could form the basis of your own 
locking mechanism, provided these are not too expensive either. He 
used this to implement fast locking on objects.

Upon evaluating a node, one could replace the evaluation code by 
another one that both identifies the current thread, and jumps to 
some code for putting a thread on hold. Then, just jump to the code 
you have loaded from the node. For putting a thread to sleep you may 
have to enter some critical section, but it is no problem if that 
takes a bit of time, because that will not happen all that often.

Similar, if you rewrite a node to root normal form. Last thing you do 
is atomically exchange the evaluation code by the contructor value. 
Then you still have to check whether the old value is still your own. 
If not, you have to wake up some threads. Waking-up may take some 
time to, but that also is not common.

And yes, you need to be a bit careful before starting a garbage 
collection, because other threads may be in the middle of writing a 
node, and may have pointers to nodes stored here and there, but there 
are all sorts of thechniques thinkable to deal with that.

Net seems to have locking and garbage collection and support for 
threads for compiled code.

Bottom line: yes, you will loose some efficiency, but I have not yet 
seen any figures for a Pentium.

regards,
Marco