Thread: Implementing logarithm barrier in posix

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    2

    Implementing logarithm barrier in posix

    I've been trying to implement logarithm barrier with condition variables using algorithm Log Barrier using PThread Condition Variables : CS 484 but I think it is missing something, because in the end, some of the threads are waiting for signal. The only thing I modified was removing these lines:


    /* I am the last one in */
    /* swap the new value pointer with the old value pointer */
    tmp = oplate;
    oplate = iplate;
    iplate = tmp;
    /*fprintf(stderr,"%d: swapping pointers\n", thread_id);*/


    /* set the keepgoing flag and let everybody go */
    keepgoing = 0;
    for (q = 0; q < nproc; q++)
    keepgoing += lkeepgoing[q];

    Because they were unused (maybe the author has forgotten to post some additional code).
    Could you please tell me what is wrong with it? Thanks.


  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> Could you please tell me what is wrong with it?
    As far as I'm concerned it's garbage and shouldn't be referenced at all.

    What exactly are you trying to achieve?

    gg

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    2
    Quote Originally Posted by Codeplug View Post
    >> Could you please tell me what is wrong with it?
    As far as I'm concerned it's garbage and shouldn't be referenced at all.

    What exactly are you trying to achieve?

    gg
    Thank you for your reply. I'm trying to make a barrier using multiple condition variables so that the number of sent signals is logarithmic, (related to the number of threads).

  4. #4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finding logarithm of a number using Recursive relations
    By ShubhamDepp in forum C Programming
    Replies: 1
    Last Post: 09-23-2012, 11:46 AM
  2. Replies: 1
    Last Post: 11-21-2011, 08:27 AM
  3. C Programming newbie language barrier problem
    By Dixi in forum C Programming
    Replies: 7
    Last Post: 10-31-2011, 09:38 AM
  4. (un)natural logarithm function using the wrong base
    By Gerling in forum C Programming
    Replies: 6
    Last Post: 08-13-2010, 02:20 AM
  5. Implementing POSIX Timers on AIX - Holy Moly
    By dedham_ma_man in forum C Programming
    Replies: 2
    Last Post: 10-03-2007, 02:36 AM

Tags for this Thread