Like Tree1Likes
  • 1 Post By Codeplug

Implementing logarithm barrier in posix

This is a discussion on Implementing logarithm barrier in posix within the C++ Programming forums, part of the General Programming Boards category; I've been trying to implement logarithm barrier with condition variables using algorithm Log Barrier using PThread Condition Variables : CS ...

  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,701
    >> 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
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,701
    You can find the un-butchered version of that code here: http://www.cs.utsa.edu/~whaley/teach...threads_ho.pdf

    gg

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, 12:46 PM
  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, 10:38 AM
  4. (un)natural logarithm function using the wrong base
    By Gerling in forum C Programming
    Replies: 6
    Last Post: 08-13-2010, 03: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, 03:36 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21