Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Wefts is out
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
SenderX  
View profile  
 More options Aug 23 2003, 11:45 am
Newsgroups: comp.programming.threads
From: "SenderX" <x...@xxx.xxx>
Date: Sat, 23 Aug 2003 15:45:21 GMT
Local: Sat, Aug 23 2003 11:45 am
Subject: Re: Wefts is out

> 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&r...

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.

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

http://AppCore.home.comcast.net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google