[lkml]   [2001]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: threading question

    On 20010613 Kurt Garloff wrote:
    > What I do in my numerics code to avoid this problem, is to create all the
    > threads (as many as there are CPUs) on program startup and have then wait
    > (block) for a condition. As soon as there's something to to, variables for
    > the thread are setup (protected by a mutex) and the thread gets signalled
    > (cond_signal).
    > If you're interested in the code, tell me.

    I use the reverse approach. you feed work to the threads, I create the threads
    and let them ask for work to a master until it says 'done'. When the
    master is queried for work, it locks a mutex, decide the next work for
    that thread, and unlocks it. I think it gives the lesser contention and
    is simpler to manage.

    J.A. Magallon # Let the source be with you...
    Linux Mandrake release 8.1 (Cooker) for i586
    Linux werewolf 2.4.5-ac13 #1 SMP Sun Jun 10 21:42:28 CEST 2001 i686
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 12:55    [W:0.019 / U:3.088 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site