Re: locking

From: Brooks Davis (brooks_at_one-eyed-alien.net)
Date: 09/23/04

  • Next message: B: "Re: IPv6 route mutex recursion (crash) and fix"
    Date: Thu, 23 Sep 2004 11:16:05 -0700
    To: Waldemar Kornewald <Waldemar.Kornewald@web.de>
    
    
    

    On Thu, Sep 23, 2004 at 12:22:33PM +0200, Waldemar Kornewald wrote:
    > Hi again,
    > we at the Haiku networking team are considering a port of your 5.3
    > netstack because it is thread-safe and making the old one (4.x, I think)
    > thread-safe is probably a much bigger task.

    It depends on the model you want. You may also wish to consider the
    direction DragonFly BSD is taking. It's interesting if unproven. I
    don't really know enough about Haiku OS to comment more.

    > Now, I saw that the routing code seems to use macros for the locking
    > code. Do you use macros everywhere?

    We usually use macros for locking. It allows us to hid the details of
    the calls since they aren't very informative. In other cases like ifnet
    we use macros as though we were using reader-writer locks, but in fact
    we currently use mutexes since sx locks are more expensive.

    > We would prefer having native threads and locks. Haiku only has
    > semaphores, not mutexes, is that a problem?

    You can implement mutexes using semaphores, but semaphores tend to be a
    more expensive since they are more expressive them mutexes.

    -- Brooks

    -- 
    Any statement of the form "X is the one, true Y" is FALSE.
    PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
    
    



  • Next message: B: "Re: IPv6 route mutex recursion (crash) and fix"

    Relevant Pages

    • [PATCH] kernel/cpuset.c mutex conversion comment fix
      ... The conversion of kernel/cpuset from semaphores to mutexes ... I didn't know offhand the state of read-write mutexes, ... - * We have two global cpuset semaphores below. ... - * zero, then only attach_task, which holds both semaphores, can ...
      (Linux-Kernel)
    • Re: help w/ mutex
      ... Mutexes are not any faster than semaphores, as they both involve switch to ... > thread-dependant, they are merely count down dependant. ... a CriticalSection is probably what you ...
      (microsoft.public.win32.programmer.kernel)
    • Re: help w/ mutex
      ... > Microsoft claims Mutexes are quicker, ... > Semaphores are non binary, they are based on a count-down, you can ... A semaphore can block a high priority thread ... the high priority thread to that of the lower priority thread. ...
      (microsoft.public.win32.programmer.kernel)
    • Re: [patch 04/15] Generic Mutex Subsystem, add-atomic-call-func-x86_64.patch
      ... don't forget to compare this with our existing semaphore ... this means that mutexes will be _FAR MORE EXPENSIVE_ on ARM ... We'd be far better off sticking to semaphores ...
      (Linux-Kernel)
    • Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver
      ... defined (I don't know what current kernels do), ... You need to verify the headerfiles for the above. ... Does this work with mutexes? ... New code should not use semaphores, ...
      (Linux-Kernel)