lkml.org 
[lkml]   [1999]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: deadlock avoidance?
    On Wed, Dec 08, 1999, Davide Libenzi <dlibenzi@maticad.it> wrote:
    > Wednesday, December 08, 1999 5:39 PM
    > Johannes Erdfelt <jerdfelt@sventech.com> wrote :
    > > Process A on CPU #0 acquires lock->lock and then goes to set the
    > > lock->pid. Process B on CPU #1 then simultaneously dereferences
    > > lock->pid.
    > >
    > > AFAIK you can't guarantee than CPU #0 writes lock->pid correctly before
    > > CPU #1 tries to read it.
    > >
    > > Basically there's no locking/atmomicity of lock->pid.
    >
    > What's the problem if CPU1 read pid == 0 before CPU0 set pid = CPU0.pid ?
    > CPU1 goto acquire the lock and spin !
    > The same behaviour will appen even if CPU1 read the lock->pid after his
    > value became CPU0.pid.
    > It will go to get the lock and spin.

    What if only a portion of the 16 bit number has been written before it
    is read? IIRC there are some architectures which this could possibly
    happen on.

    JE


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

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