Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wefts is out

36 views
Skip to first unread message

Giancarlo Niccolai

unread,
Aug 17, 2003, 12:25:44 AM8/17/03
to
http://wefts.sf.net

No triumphalistic messages though: I am just here to humbly ask advices of
the experts in this NG. There is an online documentation in the site
(mmm... well, it is the only thing in the site ATM :-), and I would greatly
appreciate advices, suggestions, critics, everything.

The things I am most concerned about are:

- Coherence / usefulness of the model
- Dark spots in API
- Possible improvements

So, I am not asking anyone here "please, download it and try it!", just
asking something like "hey, how does it looks?"
----------------------

I also would like to have some more details about that sub-api level library
for microsoft windows that Sender X (real name?) told me about; also, I
have seen a little of his lib, but more details would be appreciaed. I want
to write a OSTAiL modue for windows (what is OSTAiL? mmm, I suppose you
will have to find out by yourselves :-); although I know how to do it with
standard windows Threading API, I already know that it would be a
sub-optimizing choice.

Bests,
Giancarlo Niccolai.

PS, for the curious but lazy ones, OSTAiL means Operative System Threading
Abstraction (and Independence) Layer. :-)

SenderX

unread,
Aug 22, 2003, 5:27:57 PM8/22/03
to
> So, I am not asking anyone here "please, download it and try it!", just
> asking something like "hey, how does it looks?"

It looks alright.


> I also would like to have some more details about that sub-api level
library
> for microsoft windows that Sender X (real name?) told me about; also, I
> have seen a little of his lib, but more details would be appreciaed.

Its an experimental Win32/x86 library that uses lock-free algos. whenever
possible, and tries to avoid kernel calls wherever possible. Its pretty
speedy.

Before I document the details of all the lock-free/wait-free algos. it uses,
I want to clean it up a bit...

--
The designer of the experimental, SMP and HyperThread friendly, AppCore
library.

http://AppCore.home.comcast.net


Giancarlo Niccolai

unread,
Aug 23, 2003, 11:08:54 AM8/23/03
to
SenderX wrote:

> Its an experimental Win32/x86 library that uses lock-free algos. whenever
> possible, and tries to avoid kernel calls wherever possible. Its pretty
> speedy.
>
> Before I document the details of all the lock-free/wait-free algos. it
> uses, I want to clean it up a bit...
>

Because I wanted to implement some lock free algo as separate classes, like
the lock free list. You know that lock free algos are not always the best,
or even not always desiderable (i.e. if you want to wait for a socket to
become readable, release CPU by locking is the best thing to do), but they
are valuables for many applications i.e parallel math calculations on SMP
machines. So, I would give it a try and put them on wefts...

Giancarlo.

SenderX

unread,
Aug 23, 2003, 11:45:21 AM8/23/03
to
> Because I wanted to implement some lock free algo as separate classes,
like
> the lock free list.

This is one of the best lock-free lists out there:

http://www.cs.tau.ac.il/~shanir/reading%20group/p73-michael.pdf

You can implement this algo. in x86.

I already have, and will probably post the code.

I have a special lock-free read-write mutex, that will allow for objects
that depend on membership in a collection, to exists in the lock-free list.


> You know that lock free algos are not always the best,
> or even not always desiderable (i.e. if you want to wait for a socket to
> become readable

Yep. That's what IOCP is for. On Win32 that is...

;)


> So, I would give it a try and put them on wefts...

Yes, you could put them in a separate namespace:

Wefts::LockFree::x86::


Here is another cool lock-free linked-list, using the wonderful atomic_ptr:

http://groups.google.com/groups?selm=3EF64AA8.180483F2%40xemaps.com


Here is atomic_ptr:

http://groups.google.com/groups?selm=3E6B7923.57B88B09%40xemaps.com&rnum=1


This is a cas64 function:

/* Atomic 64-bit Cas */
inline bool

cas64
(
void volatile* pDest,
void* pComprand,
void* pExchange
)

{
// Validate alignment
assert( ! ( (int)pDest % sizeof( __int64 ) ) );

unsigned char ucRet;

__asm
{
/* Read comprand */
mov esi, [pComprand]
mov eax, [esi + 0]
mov edx, [esi + 4]

/* Read exchange */
mov esi, [pExchange]
mov ebx, [esi + 0]
mov ecx, [esi + 4]

/* Read dest */
mov esi, [pDest]

/* Execute */

#ifdef AC_BUILD_PROC_SMP

lock cmpxchg8b qword ptr [esi]

#else

cmpxchg8b qword ptr [esi]

#endif

/* Test */
sete ucRet
jz cas64_Success

/* Update comprand */
mov esi, [pComprand]
mov [esi + 0], eax;
mov [esi + 4], edx;
};

cas64_Success:

return ( ucRet ) ? true : false;
}

Pointer passed as dest, will have to be QWORD aligned, on SMP box's.

0 new messages