Search the web
Sign In
New User? Sign Up
liblf-dev · Lockfree data structure implementers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
an implementation of lock-free queue without atomic   Message List  
Reply | Forward Message #293 of 300 |
Re: [liblf-dev] an implementation of lock-free queue without atomic

There don't appear to be any memory barriers in your code. How are you
avoiding the issue of out-of-order execution on multiprocessor machines?

Chris

On 26 Mar 2009, at 08:12, "romandion78" <romandion78@...> wrote:

> I have an idea about lock-free queue without atomic , you can find
> source code at http://code.google.com/p/liblfqueue/downloads/list .
> Any body can send email to romandion@... . I list the code
> below and wish your help .
>
> typedef struct _qnode_st qnode_t ;
> struct _qnode_st{
> qnode_t *next ;
> } ;
>
> #define MAX_RING_SIZE 3
> typedef struct _queue_st queue_t ;
> struct _queue_st{
> qnode_t *nodes[MAX_RING_SIZE] ;
>
> int enqueue ;
> int dequeue ;
>
> qnode_t *enlast ;
> } ;
>
> int enqueue(queue_t *queue , qnode_t *node)
> {
> int old = queue->enqueue ;
> node->next = NULL ;
>
> if(queue->nodes[old] == NULL)
> {
> queue->enlast = node ;
> queue->enqueue++ ;
> if(queue->enqueue >= MAX_RING_SIZE)
> queue->enqueue = 0 ;
> queue->nodes[old] = node ;
> }
> else
> {
> queue->enlast->next = node ;
> queue->enlast = node ;
> }
>
> return 0 ;
> }
>
> qnode_t *dequeue(queue_t *queue)
> {
> int old = queue->dequeue ;
> qnode_t *tmp ;
>
> if(queue->nodes[old] == NULL)
> return NULL ;
>
> tmp = queue->nodes[old] ;
> queue->nodes[old] = tmp->next ;
> if(tmp->next == NULL)
> {
> old++ ;
> if(old >= MAX_RING_SIZE)
> old = 0 ;
> queue->dequeue = old ;
> }
>
> return tmp ;
> }
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>



Thu Mar 26, 2009 11:13 am

c_purcell_39
Offline Offline
Send Email Send Email

Forward
Message #293 of 300 |
Expand Messages Author Sort by Date

I have an idea about lock-free queue without atomic , you can find source code at http://code.google.com/p/liblfqueue/downloads/list . Any body can send email...
romandion78
Offline Send Email
Mar 26, 2009
8:59 am

There don't appear to be any memory barriers in your code. How are you avoiding the issue of out-of-order execution on multiprocessor machines? Chris...
Chris Purcell
c_purcell_39
Offline Send Email
Mar 26, 2009
11:13 am

... Thank you , Chris . Sorry for my poor english , I will try my best to express my own opinion . It is true that I don't use any memory barriers in my...
romandion78
Offline Send Email
Mar 31, 2009
7:29 am

I'm very sorry that I can not find my posted reply in this groups , this is third time .why ? ... Thank you , Chris . Sorry for my poor english , I will try...
Roman Dion
romandion78
Offline Send Email
Mar 31, 2009
7:29 am

The issue that concerns me is the ordering of memory operations on the node pointer and on the node itself. For instance, the write of the node's address to...
Chris Purcell
c_purcell_39
Offline Send Email
Mar 31, 2009
6:05 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help