honkiko / Multi-Core-Toolbox

Some tools for high performance Multi-Core computing: lock-free queues, MCS-lock, etc.
10 stars 5 forks source link

Not an Issue, just two question #1

Open filly86 opened 11 years ago

filly86 commented 11 years ago

Is your mpmc_queue.h thread safe? Can i read and write from multiple threads?

I am just asking, because you call it a multi producer and multi conusmer queue but in the example example_mpmc_queue.c you dont use any multithreading.

And is your mpmc queue safe from the ABA-Problem?

honkiko commented 10 years ago

It should be OK for reads and writes from multiple threads. I'll update the example and test it in one month. Or if you have time to do it, that would be great.

On Thu, Sep 19, 2013 at 2:50 AM, filly86 notifications@github.com wrote:

Is your mpmc_queue.h thread safe? Can i read and write from multiple threads?

I am just asking, because you call it a multi producer and multi conusmer queue but in the example example_mpmc_queue.c you dont use any multithreading.

— Reply to this email directly or view it on GitHubhttps://github.com/honkiko/Multi-Core-Toolbox/issues/1 .

best regards Hong Zhiguo

filly86 commented 10 years ago

I made a quick and dirty multithread test. I created 40 Threads. 20 Threads writing and 20 Thread reading simulataneously from your queue. Seams to be working, although i am not sure if your queue is safe from the ABA Problem?  

 

Gesendet: Sonntag, 22. September 2013 um 08:40 UhrVon: "Hong Zhiguo" notifications@github.comAn: honkiko/Multi-Core-Toolbox Multi-Core-Toolbox@noreply.github.comCc: filly86 filipe.s@gmx.deBetreff: Re: [Multi-Core-Toolbox] Not an Issue, just two question (#1)

It should be OK for reads and writes from multiple threads. I'll update the example and test it in one month. Or if you have time to do it, that would be great. On Thu, Sep 19, 2013 at 2:50 AM, filly86 notifications@github.com wrote:

Is your mpmc_queue.h thread safe? Can i read and write from multiple threads?

I am just asking, because you call it a multi producer and multi conusmer queue but in the example example_mpmc_queue.c you dont use any multithreading.

— Reply to this email directly or view it on GitHubhttps://github.com/honkiko/Multi-Core-Toolbox/issues/1 .

best regards Hong Zhiguo — Reply to this email directly or view it on GitHub.

honkiko commented 10 years ago

Thanks for your testing. Versioned pointer and double CAS is is taken to deal with ABA problem. The version is stored in unsigned long integer. So I think it's strong enough to avoid any ABA problem. Could you contribute your test code into this repo? That would help a lot.

On Sun, Sep 22, 2013 at 9:16 PM, filly86 notifications@github.com wrote:

I made a quick and dirty multithread test. I created 40 Threads. 20 Threads writing and 20 Thread reading simulataneously from your queue. Seams to be working, although i am not sure if your queue is safe from the ABA Problem?

Gesendet: Sonntag, 22. September 2013 um 08:40 UhrVon: "Hong Zhiguo" < notifications@github.com>An: honkiko/Multi-Core-Toolbox < Multi-Core-Toolbox@noreply.github.com>Cc: filly86 filipe.s@gmx.deBetreff: Re: [Multi-Core-Toolbox] Not an Issue, just two question (#1)

It should be OK for reads and writes from multiple threads. I'll update the example and test it in one month. Or if you have time to do it, that would be great. On Thu, Sep 19, 2013 at 2:50 AM, filly86 notifications@github.com wrote:

Is your mpmc_queue.h thread safe? Can i read and write from multiple threads?

I am just asking, because you call it a multi producer and multi conusmer queue but in the example example_mpmc_queue.c you dont use any multithreading.

— Reply to this email directly or view it on GitHub< https://github.com/honkiko/Multi-Core-Toolbox/issues/1> .

best regards Hong Zhiguo — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/honkiko/Multi-Core-Toolbox/issues/1#issuecomment-24881853 .

best regards Hong Zhiguo