Partial Equivalence

Embed Size (px)

Citation preview

  • 8/3/2019 Partial Equivalence

    1/19

    Math . S y s t e m s T h e o r y 2 6 , 2 1 - 3 9 ( 1 9 9 3 ) MathematicalSystems Theory 1 9 9 3 S p r i n g e r - V e r l a g N e w Y o r k I n c .

    A Partial Equivalence Between Shared-Memory and Message-Passing

    in an Asynchronou s Fail-Stop Distributed Environme nt*

    Amotz Bar-Noy r and Danny Dolev 2

    'IBM T . J . W a t s o n R e s e a r c h C e n t e r , P .O . B o x 7 0 4 , Y o r k t o w n H e i g h t s , NY 10598, USA'IBM Almaden Res earch Center, 650 Harry Road, San Jose, CA 95120, USA and

    C o m p u t e r S c i e n c e D e p a r t m e n t , T h e He b r e w U n i v e r s i t y , J e r u s a l e m , I s r a e l

    A b s t r a c t . T h i s p a p e r p r e s e n t s a s c h e m a t i c a l g o r i t h m f o r d i s t r i b u t e d s y s t em s .

    This schematic algorithm uses a "black-box" procedure f or communica-

    tion, the output of which must meet two requirements : a g l o b a l - o r d e r

    r e q u i r e m e n t a n d a d e a d l o c k - f r e e r e q u i r e m e n t . T hi s a l go r it h m i s va l i d i n a n y

    d i s t r i b u t e d s y s t e m m o d e l t h a t c a n p r o v i d e s u c h a c o m m u n i c a t i o n p r o c e d u r e

    t h a t c o m p l i e s w i t h t h e s e r e q u i r e m e n t s . T w o s u c h m o d e l s e x i s t i n a n a s y n c h r o -

    n o u s fa i l - s t o p e n vi r o n m e n t : o n e i n t h e s h a r e d - m e m o r y m o d e l a n d o n e i n t h e

    message-passing model . T h e i m p l e m e n t a t i o n o f t h e b l o c k - b o x p r o c e d u r e i n

    t h e s e m o d e l s e n a b l e s u s t o t r a n s l a t e e x i s t i n g a l g o r i t h m s b e t w e e n t h e t w o

    m o d e l s w h e n e v e r t h e s e a l g o r i t h m s a r e b a s e d o n t h e s c h e m a t i c a l g o r i t h m .

    We demonstrate this idea in two ways . F i r s t , w e p r e s e n t a r a n d o m i z e d

    a l g o r i t h m f o r t h e c o n s e n s u s p r o b l e m i n t h e m e s s a g e - p a s s i n g m o d e l b a s e d o n

    t h e a l g o r i t h m o f A s p n e s a n d H e r l i h y [ A H ] i n t h e s h a r e d - m e m o r y m o d e l . This

    s o l u t i o n i s t h e f a s t e s t k n o w n r a n d o m i z e d a l g o r i t h m t h a t s o l v e s t h e c o n s e n s u s

    p r o b l e m a g a i n s t a s t r o n g f a i l - s t o p a d v e r s a r y w i t h o n e - h a l f r e s i l i e n c y . S e c o n d ,

    w e s o l v e t h e p r o c e s s o r r e n a m i n g p r o b l e m i n t h e s h a r e d - m e m o r y m o d e l b a s e d

    o n t h e s o l u t i o n o f A t t i y a et a l . [ABD + ] i n t h e m e s s a g e - p a s si n g m o d e l . T h ee x i s t e n c e o f t h e s o l u t i o n t o t h e r e n a m i n g p r o b l e m s h o u l d b e c o n t r a s t e d w i t h

    t h e i m p o s s i b i l i t y r e s u l t f o r t h e c o n s e n s u s p r o b l e m i n t h e s h a r e d - m e m o r y m o d e l

    [CIL], [DDS], [LA] .

    * A p r e l i m i n a r y v e r s i o n o f t h i s p a p e r , " S h a r e d - M e m o r y v s . M e s s a g e - P a s si n g i n a n A s y n c h r o -

    nous Distributed Environment," appeared in Proc . 8th A CM S y m p . o n P r i n c i p l e s o f D i s t r i b u t e d

    Computing, pp . 3 0 7 - 3 1 8 , 1 9 8 9 . P a r t o f t h i s w o r k w a s d o n e w h i l e A . Bar-Noy visited the Computer

    S c i e n c e D e p a r t m e n t , S t a n f o r d U n i v e r s i t y , S t a n f o r d , C A 9 4 3 0 5 , U S A , a n d h i s r e s e a r c h w a s s u p p o r t e d

    i n p a r t b y a W e i z m a n n f e l l o w s h i p , b y C o n t r a c t O N R N 0 0 0 1 4 - 8 8 - K - 0 1 6 6 , a n d b y a g r a n t o f S t a n f o r d ' s

    C e n t e r f o r I n t e g r a t e d S y s t e m s .

  • 8/3/2019 Partial Equivalence

    2/19

    22 A. Bar-Noy and D . D o l e v1 . I n t r o d u c t i o n

    Two major processo r intercommunication models in distributed systems have

    a t t r a c t e d m u c h a t t e n t i o n a n d s t u d y : t h e m e s s a g e p a s s i n g model and the s h a r e d -

    memory model . I n t h e m e s s a g e - p a s s i n g m o d e l , p r o c e s s o r s a r e r e p r e s e n t e d b y

    v e r t i c e s o f a network a n d m e s s a g e s a r e s e n t a l o n g l i n k s . In the shared-m emor y

    m o d e l , p r o c e s s o r s s h a r e reg i sters t h r o u g h w h i c h t h e y c o m m u n i c a t e b y p e r f o r m i n g

    r e a d a n d w r i t e o p e r a t i o n s .

    I n p a r t i c u l a r , t h e a s y n c h r o n o u s enviro nment and the f a i l - s t o p environment

    h a v e b e e n t h e u n d e r l y i n g a s s u m p t i o n s o f m a n y r e c e n t p a p e r s . R e s e a r c h e r s t r i e d

    t o u n d e r s t a n d d i s t r i b u t e d s y s t e m s w h e r e p r o c e s s o r s o p e r a t e a t d i f f e r e n t r a t e s a n d

    d o n o t s h a r e a u n i q u e g l o b a l c l o c k . T h e y a l s o t r i e d t o u n d e r s t a n d d i s t r i b u t e d

    s y s t e m s w h e r e s o m e o f t h e p r o c e s s o r s m a y s u d d e n l y f a i l a n d s t o p o p e r a t i n g ( c r a s h ) .

    T h e m a i n d i f f i c u l t y i n a n a s y n c h r o n o u s a n d f a i l - s t o p e n v i r o n m e n t i s h o w t o

    d i s t i n g u i s h b e t w e e n s l o w p r o c e s s o r s a n d c r a s h e d p r o c e s s o r s . T h e d i s t i n c t i o n

    b e t w e e n t h e s e t w o m o d e s o f o p e r a t i o n i s t h e c h a l l e n g e i n s o l v i n g c o o r d i n a t i o n

    problems . I n s u c h p r o b l e m s a s e t o f p r o c e s s o r s a r e a s k e d t o m a k e a d e c i s i o n

    d e p e n d i n g u p o n s o m e i n i t i a l i n p u t t h a t e a c h o n e o f t h e m p o s s e s s e s . T h e A g r e e m e n t

    Problem [ PSL] and the Leader Election Pro blem [GH S] are among the famous

    c o o r d i n a t i o n p r o b l e m s s t u d i e d i n r e c e n t d e c a d e s .

    Unfortunately, since the shared-memory model and the message-passing

    m o d e l a r e n o t e q u i v a l e n t , m a n y c o o r d i n a t i o n p r o b l e m s w e r e s o l v e d f o r e a c h m o d e l

    s e p a r a t e l y . T h e r e f o r e , f i n d i n g w a y s t o t r a n s l a t e e x i s t i n g a l g o r i t h m s f r o m o n e m o d e l

    t o t h e o t h e r i s a n i n t r i g u i n g q u e s t i o n i n d i s t r i b u t e d s y s t e ms . T h i s p a p e r p r o v i d e s

    a w a y t o t r a n s l a t e c e r t a i n t y p e s o f a l g o r i t h m s b e t w e e n t h e s e t w o m o d e l s i n a n

    a s y n c h r o n o us a n d f a i l - s t o p e n v i r o n m en t . T h e g o a l i s t o f i n d a n e q u i v a l e n c e t h a t

    p r e s e r v e s t h e c o m p l e x i t y m e a s u r e s : t i m e , t h e s i z e o f m e s s a g e s o r s h a r e d r e g i s t e r s ,

    l o c a l m e m o r y a n d l o c a l c o m p u t a t i o n . I n c e r t a i n c a s e s , p r o v i n g t h a t t h e e x i s t e n c e

    o f a s o l u t i o n i n o n e m o d e l i m p l i e s i t s e x i s t e n c e i n t h e o t h e r i s i m p o r t a n t b y i t s e l f .

    We present a s c h e m a t i c a l g o r i t h m f o r d i s t r i b u t e d s y s t e m s . T h i s a l g o r i t h m u s e s

    a b l a c k - b o x procedure for communication . T h e c o l l e c t i o n ' o f a l l o u t p u t s o f t h i s

    procedure, no matter which processor invo ked the procedure, must mee t two

    r e q u i r e m e n t s : a g l ob al -o rd er requirement and a d ea d lo c k f re e r e q u i r e m e n t . A n y

    p r o o f o f c o r r e c t n e s s a s s u m i n g o n l y t h e s e t w o r e q u i r e m e n t s r e g a r d i n g t h e o u t p u t s

    is valid in any distributed system model that can provi de a communi cation

    p r o c e d u r e t h a t c o m p l i e s w i t h t h e s e r e q u i r e m e n t s . We then introduce two such

    c o m m u n i c a t i o n p r o c e d u r es i n a n a s y n c h r o n o u s f a i l - s t o p e n v i r o n m e n t : o n e i n t h e

    s h a r e d - m e m o r y m o d e l w h e r e t h e c o m m u n i c a t i o n i s v i a w a i t - f r e e a t o m i c r e a d a n d

    w r i t e r e g i s t e r s a n d o n e i n t h e m e s s a g e - p a s s i n g m o d e l w h e r e t h e c o m m u n i c a t i o n

    i s vi a a f u l l y c o n n e c t e d network and the r es il ie nc y i s o n e - ha l f . A p p l y i n g t h e s e

    p r o c e d u r e s e n a b l e s u s t o t r a n s l a t e . e x i s t i n g a l g o r i t h m s b e t w e e n t h e t w o m o d e l s

    w h e n e v e r t h e s e a l g o r i t h m s a r e b a s e d o n t h e s c h e m a t i c a l g o r i t h m . ( N o t e t h a t C h o r

    a n d M o s c o v i c i [ C M ] h a v e d e m o n s t r a t e d t h a t f o r c e r t a i n t y p e s o f p r o b l e m s t h e

    a b o v e t w o m o d e l s a r e n o t e q u i v a l e n t . T h e r e a r e p r o b l e m s t h a t c a n b e s o l v e d i n

    t h e m e s s a g e - p a s s i n g m o d e l w i t h r e s i l i e n c y o n e - h a l f b u t h a v e n o w a i t - f r e e s o l u t i o n

    i n t h e s h a r e d - m e m o r y m o d e l a n d v i c e v e r s a . )

  • 8/3/2019 Partial Equivalence

    3/19

    Partial Equivalence Between Shared-Memory and Message-Passing 2 3

    T w o e x a m p l e s o f s u c h a l g o r i t h m s e x i s t . O n e i s t h e s o l u t i o n o f A s p n e s a n d

    H e r l i h y [ A H ] t o t h e c o n s e n s u s p r o b l e m i n t h e s h a r e d - m e m o r y m o d e l a n d o n e i s

    t h e s o l u t i o n o f A t t i y a et a l . [ABD " ] t o t h e renaming problem i n t h e m e s s a g e -p a s s i n g m o d e l . T h e s e s o l u t i o n s a s s u m e o n l y t h e g l o b a l - o r d e r r e q u i r e me n t a n d t h e

    d e a d l o c k - f r e e r e q u i r em e n t a n d , c o n s e q u e n t l y, t h e s e s o l u t i o n s a r e v a l i d i n b o t h

    models . The randomized solution for the consensus prob lem in the message-

    p a s s i n g m o d e l i s t h e f a s t e s t k n o w n r a n d o m i z e d a l g o r i t h m f o r s o l v i n g t h i s p r o b l e m

    w i t h r e s i l i e n c y o n e - h a l f a g a i n s t t h e s t r o n g e s t p o s s i b l e a d v e r s a r y i n a f a i l - s t o p

    model . T h e t i m e c o m p l e x i t y o f t h i s s o l u t i o n i s 0 ( n 2 ) e x p e c t e d n u m b e r o f r o u n d s

    where n i s t h e n u m b e r o f p r o c e s s o r s . T h i s i m p r o v e s t h e r es u l t o f B e n - O r [ B] o f

    0 ( 2 " ) e x p e c t e d n u m b e r o f r o u n d s . T h e s o l u t i o n f o r t h e r e n a m i n g p r o b l em i n t h e

    s h a r e d - m e m o r y m o d e l i s t h e f i r s t d e t e r m i n i s t i c w a i t - f r e e s o l u t i o n t o a c o o r d i n a t i o n

    p r o b l e m u s i n g a t o m i c r e g i s t e r s . I t s e x i s t e n c e s h o u l d be c o n t r a s t e d w i t h t h e

    i m p o s s i b i l i t y r e s u l t f o r t h e c o n s e n s u s p r o b l e m i n t h i s m o d e l [ C I L ] , [ D D S ] , [LA] .

    T h e r e s t o f t h e p a p e r e i s o r g a n i z e d a s f o l l o w s . I n S e c t i o n 2 w e d e s c r i b e t h e

    t w o m o d e l s c o n s i d e r e d i n t h i s p a p e r . T h e s c h em a t i c a l g o r i th m i s p r e s en t e d i n

    S e c t i o n 3 a n d t h e t w o c o m m u n i c a t i o n p r o c e d ur e s a r e p r e s e n t e d i n S e c t i o n 4 . O u r

    t w o a p p l i c a t i o n s f o r t h e c o n s e n s u s p r o b l e m a n d t h e r e n a m i n g p r o b l e m a p p e a r i n

    S e c t i o n s 5 a n d 6 r e s p e c t i v e l y .

    2 . The Shared-Memory and the Message-Passing Model s

    2 . 1 The Shared-Memor y Model

    T h e s h a r e d - m e m o r y m o d e l i s d e f i n e d a s f o l l o w s ( f o r m o r e d e t a i l s s e e [AH]) .

    T h e r e a r e n p r o c e s s o rs t h a t c o m m u n i c a t e b y r e a d i n g a n d w r i t i n g i n t o reg i sters .

    T h e r eg i s te r s a r e a t o m i c s i n g l e - w r i te r m a n y - r e a d er reg i sters . E a c h p r o c e s s o r h a s

    a n a s s i g n e d r e g i s t e r a n d i s t h e o n l y o n e t h a t c a n w r i t e t o i t . H o w e v e r , a l l p r o c e s s o r s

    c a n r e a d a l l r e g i s t e rs . T h e n o n l o c a l a t o m i c o p e r a t i o n s a p r o c e s s o r c a n e x e c u t e

    without interference are READ and WR ITE on a single reg ister . T h u s , o n c e a

    p r o c e s s o r b e g i n s e a c h o f t h e s e o p e r a t i o n s i t c a n c o m p l e t e i t w i t h o u t t h e n e e d t o

    w a i t fo r a n y ot h er p r oc e s so r ( se e [ L ]) . I n t u i t i v e l y , t h i s p r o p e r t y i m p l i e s t h a t a

    r e a d e r n e e d n o t w a i t f o r a w r i t e r t o c o m p l e t e a r e a d o p e r a t i o n . T h u s , e v e n i f t h e

    w r i t e r c r a s h e s , t h e r e a d e r c a n c o m p l e t e i t s r e a d o p e r a t i o n . S i m i l a r l y , a w r i t e r n e e d

    n o t w a i t f o r r e a d e r s t o c o m p l e t e t h e i r o p e r a t i o n s .

    This requirement can be extended to any action a processor performs .

    I n t h i s p a p e r w e f o c u s o n l y o n w ai t f re e p r o to c o l s, w h e re a p r o c es s o r i s a b le t o

    c o m p l e t e a n y a c t i o n o r s e t o f a c t i o n s w i t h o u t w a i t i n g f o r t h e c o m p l e t i o n o f o t h e r

    a c t i o n s a t a n y o t h e r p r o c e s s o r . This models the asynchrony of the system

    a n d t he fa c t t ha t e ve n n - 1 p r o c e s s o rs m a y c r a s h . H o w e v e r , a p r o c e s s o r c a n n o t

    q u i t a f t e r m a k i n g i t s d e c i s i o n b e f o r e a l l o t h e r p r o c e s s o r s m a k e t h e i r d e c i s i o n . I t

    c a n n o t e r a s e t h e c o n t e n t o f i t s r e g i s t e r , o t h e r w i s e s o m e p r o c e s s o r s m a y a s s u m e

    t h a t o t h e r p r o c e s s o r s t h a t h a d a l r e a d y m a d e t h e i r d e c i s i o n s a r e c r a s h e d p r o c e s s o r s

    a n d t h i s m a y l e a d t o i n c o n s i s t e n t d e c i s i o n s i n m a n y c o o r d i n a t i o n p r o b l e m s .

    This shared-memory model has been considered in many papers . L e t u s

    n o w s u m m a r i z e s o m e r e s u l t s t h a t a r e r e l e v a n t t o o u r p a p e r . I n va r i o us p a p e r s

  • 8/3/2019 Partial Equivalence

    4/19

    24 A. Bar-Noy and D . D o l e v(see [ C I L ] , [ D DS ] , an d [ LA ]) i t w a s p r o v e n t h a t t h e r e i s n o d e t e r m i n s t i c

    w a i t - f r e e s o l u t i o n f o r t h e c o n s e n s u s p r o b l e m w h e n t h e a t o m i c o p e r a t i o n s a r e

    read and write . A t o m i c o p e r a t i o n s t h a t a r e s u f f i c i e n t t o s o l v e t h e c o n s e n s u s

    problem are explored in [H ] . I n s e v e r a l p a p e r s ( s e e [A], [AH], [CIL], and

    [ A D S ] ) r a n d o m i z e d a l g o r i t h m s a r e r e p r e s e n t e d f o r t h e c o n s e n s u s p r o b l e m .

    2 . 2 . The Message-Passing Model

    W e d e f i n e t h e m e s s a g e - p a s s i n g m o d e l a s f o l l o w s ( f o r m o r e d e t a i l s s e e [ A B D + ] ) .

    T h e r e a r e n p r o c e s s o r s t h a t a r e c o n n e c t e d b y a c o m p l e t e n e t w o r k . We assume

    t h a t w h e n a p r o c e s s o r s e n d s a m e s s a g e , i t b r o a d c a s t s t h e s a m e m e s s a g e t o a l l o t h e r

    p r o c e s s o r s . T h e f a i l - s t o p e n v i r o n m e n t i s c h a r a c t e r i z e d b y a p a r a m e t e r t (t < n )

    which is an upper bound for the number of pr ocesso rs that may crash . The

    a s y n c hr o n y i s r e p r e s en t e d b y a g a m e b et w e en a n a d v e rs a r y a n d a g i v e n a l g o r i t h m .

    T h e g o a l o f t h e a d v e r s a r y i s t h e f a i l u r e o f t h e a l g o r i t h m .

    T h i s p a p e r c o n s i d e r s t h e f o l l o w i n g s t r o n g a d v e r s a r y i n a n a s y n c h r o n o u s

    a n d f a i l - s t o p e n v i r o n m e n t . T h e a d v e r s a ry i n s t r u c t s t h e p r o c es s o r s w h e n t o o p e r a t e

    a n d w h e n t o s t o p . H o w ev e r , i t c a n s t op u p to t p r o c e s s o r s . W h e n e v e r a p r o c e s s o r

    w a i t s f o r m e s s a g e s , i t c a n n o t e x p e c t t o r e c e i v e m o r e t h a n n - t messages from

    d i f f e r e n t p r o c e s s o r s s i n c e t h e o t h e r t m e s s a g e s m a y b e l o n g t o c r a s h e d p r o c e s s o r s .

    M e s s a g e s c a n a r r i v e o u t o f o r d e r a s t h e a d v e r s a r y h a s t h e p o w e r t o d i c t a t e t h e i r

    d e l i v e r y t i m e . T h e a d v e r s a r y c a n p l a n i t s s t r a t e g y b y o b s e r v i n g t h e m e s s a g e s t o

    b e s e n t a n d t h e i n t e r n a l s t a t e o f t h e p r o c e s s o r s . T h e r e a r e n o c r y p t o g r a p h i c

    a s s u m p t i o n s , o r o t h e r l i m i t a t i o n s o n t h e p o w e r o f t h e a d v e r s a r y . I t i s o n l y

    prevented from changing messages, changing the steps processors take, and

    p r e d i c t i n g t h e o u t c o m e o f c o i n f l i p s i n r a n d o m i z e d a l g o r i t h m s . The number t , t h e

    u p p e r b o u n d f o r t h e n u m b e r o f p r o c e s s o r s t h a t m a y c r a s h , i s c a l l e d t h e resi l i e n c e

    p a r a m e t e r o f t h e s y s t e m . ( T r a d i t i o n a l l y , t h e p a r a m e t e r t was an upper bound on

    the number of f a u l t y p r o c e s s o r s , w h i c h d o n o t f o l l o w t h e i r a l g o r i t h m . )

    F o l l o w i n g t h e p r o o f i n [ A B D+ ]

    i t i s e a s y t o s e e t h a t , f o r m a n y c o o r d i n a t i o n

    p r o b l e m s , i f n < 2 t , t h e r e i s n o a l g o r i t h m t h a t c a n p r e v a i l over s u c h a n a d v e r s a r y

    B e c a u s e t h e a d v e r s a r y c a n f o r c e t w o g r o u p s o f a t m o s t t p r o c e s s o r s t o o p e r a t e

    s e p a r a t e l y b y s u s p e n d i n g a l l t h e m e s s a g e s b e t w e e n t h e t w o g r o u p s a n d t h i s m a y

    l e a d t o i n c o n s i s t e n t a c t i o n s b y t h e t w o g r o u p s . F u r t h e r m o r e , b y s i m i l a r r e a s o n i n g ,

    a t l e a s t 2 t + 1 p r o c e s s o r s , e v e n i f t h e y h a v e a l r e a d y m a d e t h e i r o w n d e c i s i o n s ,

    m u s t c o n t i n u e s e n d i n g a n d r e c e i v i n g m e s s a g e s i n o r d e r t o h e l p o t h e r p r o c e s s o r s

    m a k e t h e i r d e c i s i o n . I n t h i s p a p e r , t i ss e t t o i t s m a x i m a l p o s s i b l e v a l u e f o r m a n y

    c o o r d i n a t i o n p r o b l e m s , i . e . , n = 2 t + 1 .

    Let us now summarize some results in this message-passing model that

    a r e r e l e v a n t t o o u r p a p e r . Fi sc he r e t a l . [FLP] proved that the consensus

    p r o b l e m i s n o t s o l v a b l e d e t e r m i n i s t i c a l l y a g a i n s t s u c h a n a d v e r s a r y e v e n w h e n

    t = 1 . Y e t , i t i s p o s s i b l e t o o v e r c o m e t h e a d v e r s a r y w i t h a r a n d o m i z e d a l g o r i t h m

    [B], [CMS], and [DSS] . T h e r e s u l t o f [ F L P ] w a s g e n e r a l i z e d i n t h e p a p e r s [ D D S ]

    a n d [ D L S ] w h e r e t h e l e v e l o f s y n c h r o n y n e e d e d t o s o l v e t h e c o n s e n s u s p r o b l e m

    i s studi ed . F i n a l l y , s o m e p a p e r s ( e . g . ,[ABD + ] , [BMZ], and [BW]) i d e n t i f y c e r t a i n

    p r o b l e m s t h a t a r e s o l v a b l e d e t e r m i n s t i c a l l y i n t h e p r e s e n c e o f s u c h a n a d v e r s a r y.

  • 8/3/2019 Partial Equivalence

    5/19

    Partial Equivalence Between Shared-Memory and Message-Passing 2 5

    3 . The Schematic Algorithm

    I n t h i s s e c t i o n w e p r e s e n t a s c h e m a t i c a l g o r i t h m f o r a n a s y n c h r o n o u s d i s t r i b u t e d

    s y s t e m ( F i g u r e 1 ). T h e o n l y w a y p r o c e s s o r s c o m m u n i c a t e b e t w e e n t h e m s e l v e s i s

    b y c a l l i n g P r o c e d u r e s C O M M U N IC A T E a n d H E L P - C O M MU N IC A T E . T h e

    r e s t o f t h e c o d e i s l o c a l a n d i s i n d e p e n d e n t o f t h e s p e c i f i c m o d e l i n w h i c h t h e

    s c h e m a t i c a l g o r i t h m i s i n v o k e d . H o w e v e r , t h e s c h e m a t i c a l g o r i t h m d e m a n d s t w o

    requir ements from the outputs of Procedu re COMMUNICATE, called the g l o b a l -

    o r de r r e qu i re m en t a n d t h e d e a d l o c k f r e e r e q u i r e m en t . T h e s c h e m a t i c a l g o r i t h m i s

    u s e d a s f o l l o w s . L e t d b e a d i s t r i b u te d a l g o r i t h m , t h e c o d e o f w h i c h f o l l o w s t h e

    c o d e o f t h e s c h e m a t i c a l g o r i t h m ( F i g u r e 1 ) . S u p p o s e t h a t t h e g l o b a l - o r d e r r e q u i r e -

    m e n t a n d t h e d e a d l o c k - f r e e r e q u i r e m e n t a r e t h e o n l y p r o p e r t i e s o f P r o c e d u r e

    COMMUNICATE used in the proof of V . T h e n t h e p r o o f i s v a l i d i n a n y m o d e l

    that can implement Procedure C OMMUNICATE, as long as the implementation

    s a t i s f i e s t h e s e t w o r e q u i r e r m e n t s .

    A proces sor p, that executes Algorithm SCHE MATIC, gets some I n p u t and

    n e e d s t o p r o d u c e s o m e Output . W e s a y t h a t p r o c e s s o r p d e c i d e s at the momen t p

    i s a b l e t o p r o d u c e t h e o u t p u t . L e t I b e t h e s e t o f a l l t h e l o c a l v a r i a b l e s o f p r o c e s s o r

    p , w h e r e s o m e o f t h e v a r i a b l e s g e t t h e i r i n i t i a l v a l u e f r o m t h e i n p u t . A s u b s e t o fI ,

    o r s o m e f u n c t i o n o f I , i s c o m m u n i c a t e d w i t h o t h e r p r o c e s s o r s i n t h e s y s t e m . We

    c a l l t h e s e v a r i a b l e s t h e c o m m u n i c a t i o n v a r i a b l e s o f p . P r o c e s s o r p c o l l e c t s t h e

    c o m m u n i c a t i o n v a r i a b l e s o f o t h e r p r o c e s s o r s . F o r t h a t p u r p o s e , p m a i n t a i n s a

    v e c t o r X o f l en g t h n . T h e e n t r y X ( q ) o f t h e v e c t o r i s t h e m o s t r e c e n t v a l u e o f t h ec o m m u n i c a t i o n v a r i a b l e s o f p r o c e s s o r q t h a t p knows about . T h e e n t r y X ( p ) is the

    v a l u e o f t h e c o m m u n i c a t i o n v a r i a b l e s o f p i t s e l f a n d i t c o n t a i n s i t s m o s t u p d a t e d

    v a l u e . W e c a l l t h i s v e c t o r t h e c o m m un i c a t i o n v e c t or o f p r o c e s so rp . P r o c e s s o r p

    w o r k s i n r o u n d s . I n e a c h r o u n d , p f i r s t c o m m u n i c a t e s w i t h t h e o t h e r p r o c e s s o r s

    a n d t h e r e b y u p d a t e s i t s c o m m u n i c a t i o n v e c t o r . T h e n p u p d a t e s i t s l o c a l v a r i a b l e s

    ( 1 ) a n d u p d a t e s t h e a p p r o p r i a t e e n t r y i n i t s c o m m u n i c a t i o n v e c t o r ( X ( p ) ) . P r o c e s s o r

    p c o n t i n u e s t o t h e n e x t r o u n d i f i t h a s n o t y e t d e c i d e d . When p d e c i d e s a n d t h e

    Algor ithm SCH EMATIC(Input, Output) ;

    v a r I: s e t o f v ar i ab l e s ;X v e c t o r o f l e n g t h n ;b e g i n

    I := s o m e f u n c t i o n o f I n p u t ;

    f o r e a c h p r o c e s s o r q do X ( q ) : = a n u l l v a l u e ;

    w h i l e d e c i s i o n i s n o t m a d e do

    X(p) := s o m e f u n c t i o n o f I ;COMMUNICATE(X) ;I : = s o m e f u n c t i o n o f X ;

    e n d - w h i l e ;

    Output : = s o m e f u n c t io n o f I ;HELP-COMMUNICATE(X) ;en d ;

    Fi g . 1 . T h e s c h e m a t i c a l g o r i t h m f o r p r o c e s s o r p .

  • 8/3/2019 Partial Equivalence

    6/19

    2 6 A. Bar-Noy and D . D o l e voutput is produced, processor p calls Procedure H ELP-CO MMUNICATE . A s

    m e n t i o n e d i n t h e p r e v i o u s s e c t i o n , i n b o t h m o d e l s p c a n n o t s t o p c o m p l e t e l y u n t i l

    e v e r y b o d y h a s m a d e a d e c i s i o n . I n t he s h a r e d -m e m o r y m o d e l , p c a n n o t e r a s e t h e

    c o n t e n t s o f i t s r e g i s t e r , a n d i n t h e m e s s a g e - p a s s i n g m o d e l , p m u s t a c t i v e l y

    c o m m u n i c a t e w i t h o t h e r p r o c e s s o r s .

    W e n o w d e f i n e t h e g l o b a l - o r d e r r e q u i r e m e n t . F i r s t , w e a s s u m e t h e f o l l o w i n g

    l o c a l - o r d e r a s s u m p t i o n :

    Assumption 3. 1 . L e t t h e v a l ue s o f t h e c o m mu n i c a t i o n v a ri a bl e s o f a l l p r o c e s s o r s

    b e t a k e n f ro m a p a r t i a l l y o rd e r e d c o l l ec t i o n / c o n t a i n i n g a n u l l v a l ue w h i c h i s l e s s

    t h a n a l l t h e o t h e r v a l u e s . I f , i n t i m e s t l < t 2 , p r o c e s s o r p h e l d t h e c o m m u n i c a t i o n

    v a r i a b l e s v a l u e J l a n d J 2 r e s p e c t i v e l y , t h e n J l : 5 J 2 . M o r e o v e r , e v e r y o t h e r p r o c e s s o r

    c a n c o m p u t e - < .

    Note that this can b e satisfie d by a time- stamp system . An unbounded'

    t i m e - s t a m p s y s t e m c a n b e i m p l e m e n t e d b y a d d i n g a n u n b o u n d e d c o u n t e r t o t h e

    c o m m u n i c a t i o n v a r i a b l e s ; t h i s c o u n t e r i s i n c r e m e n t e d f o r a n y n e w v e r s i o n o f t h e s e

    v a r i a b l e s . In the shared-memory model, previous results show ways to use

    b o u n d e d t i m e - s t a m p s y s t e m [ I I ] , [ D S ] .

    N o w , a p a r t i a l o r d e r o n t h e c o m m u n i c a t i o n v e c t o r s c a n b e d e f i n e d . R e c a l l

    t h a t i f p r o c e s s o r p h o l d s t h e c o m m u n i c a t i o n v e c t o r X , t h e n X(q) i s a c o p y o f t h e

    m o s t r e c e n t c o m m u n i c a t i o n v a r i a b l e o f p r o c e s s o r q known to p .

    D e f i n i t i o n 3 . 1 . L e t Xand X' b e t w o c o m m u n i c a t i o n v e c t o r s h e l d b y p r o c e s s o r sp and q , r e s p e c t i ve l y . T h e n X - < X ' iff, for every 1 < k < n , X ( k ) - < X ' ( k ) .

    I n o t h e r w o r d s , Xp r e c e d e s X ' i f f i n a l l i t s e n t r i e s Xp r ec e de s X ' a c c o r di n g t ot h e o r d e r d e f i n e d f o r / i n A s s u m p t i o n 3 . 1 .

    D e f i n i t i o n 3 . 2 . The Global-Order Requirement . A l l t h e o u t p u t s o f P r o c e d u r e

    COMMUNICATE must form a linear order under - < , n o m a t t e r w h i c h p r o c e s s o r

    i n v o k e d t h e p r o c e d u r e .

    In any run of Algor ithm SCHEMATIC by all the proce ssors, in which the

    g l o b a l - o r d e r r e q ui r e m e n t i s m e t , w e d e f i n e t h e f o l l o w i n g .

    D e f i n i t i o n 3. 3 . A s t a b l e v e c t o r i s a v e c t o r t h a t w a s r e t u r n e d a s a n o u t p u t o fProcedure COMMUNICATE. Denote by X X2 . . . . t h e s e q u e n c e o f a l l s t a b l evectors output by any c all to Procedure COMMUNICATE, and let X 0 b e t h e

    v e c t o r w i t h a l l e n t r i e s e q u a l t o t h e n u l l v a l u e .

    A p o s s i b l e u n d e s i r a b l e o u t c o m e o f t h e g l o b a l - o r d e r r e q u i r m e n t i s d e a d l o c k .

    I t m i g h t b e t h e c a s e t h a t t h e p r o c e s s o r s w i l l c o m m u n i c a t e f o r e v e r b e c a u s e t h e y

    c a n n o t s a t i s f y t h i s r e q u i r e m e n t . T h e s e c o n d r e q u i r e m e n t a v o i d s s u c h s i t u a t i o n s .

    D e f i n i t i o n 3 . 4 . The Deadlock-Free Requirement . I f a n y n o n f a u l t y , u n d e c i d e d

  • 8/3/2019 Partial Equivalence

    7/19

    Partial Equivalence Between Shared-Memory and Message-Passing 2 7

    processor is executing Procedure COMMUNICATE, then eventually some p ro-

    c e s s o r w i l l o u t p u t a s t a b l e v e c t o r .

    N o t e t h a t t h i s d e f i n i t i o n p e r m i t s s t a r v a t i o n . H o w e v e r , i n m a n y c o o r d i n a t i o n

    p r o b l e m s , w h e n t h e r e i s a n e e d o n l y f o r o n e d e c i s i o n , a d e a d l o c k - f r e e p r o p e rt y

    i m p l i e s a n o n s t a r v a t i o n p r o p e r t y .

    4 . The Communication Procedures

    I n t h i s s e c t i o n w e p r o v i d e f o u r c o m m u n i c a t i o n p r o c e d u r e s ( F i g u r e s 2 a n d 3 ) , t w o

    i n e a c h o f t h e m o d e l s d e f i n e d i n S e c t i o n 2 . I n t h e s h a r e d - m e m o r y m o d e l t h e s e

    procedures are called SM-COMMUNICATE and SM-HELP-COMMUNI-

    CATE, and in the message-passing mod el they are called MP-COMMUNICATEand MP-HELP-COMMUNICATE .T h e i n p u t f o r a l l f o u r p r o c e d u r e s i s a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ( w h i c h

    contains the most updated version of the communic ation variables of other

    p r o c e s s o r s k n o w n t o t h e p r o c e s s o r t h a t c a l l s t h e p r o c e d u r e ) . T h e f i r s t t i m e

    P r o c e d u r e s S M - COMMUNICA T E a n d MP - C O MMUNICA T E a r e i n v o k e d b y

    p r o c e s s o r p , t h e i n p u t v e c t o r i s t h e i n i t i a l v e c t o r . I n t h e i n i t i a l v e c t o r , a l l t h e e n t r i e s

    a r e s e t t o t h e i r n u l l v a l u e e x c e p t f o r p ' s e n t r y , w h i c h i s s e t t o t h e v a l u e o f p ' s

    communication variables . I n l a t e r i n v o c a t i o n s , t h e i n p u t v e c t o r i s t h e c u r r e n t

    v e c t o r k n o w n t o p r o c e s s o r p .

    In Procedure SM-COMMUNICATE, processor p scans a l l t h e n r e g i s t e r s a n d

    c o p i e s t h e i r v a l u e s i n t o a t e m p o r a r y v e c t o r ( ) ) . I f t h e v e c t o r s t h a t r e s u l t f r o m t w o

    c o n s e c u t i v e s c a n s a r e i d e n t i c a l , t h e n t h i s v e c t o r i s t h e o u t p u t a n d t h e p r o c e d u r e

    Procedure SM-COMMUNICATE(X) ;I n p u t X a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ;Output X a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ;v a r q : a processor name ;Y: a v e c t o r o f l e n g t h n ;b e g i nR p := WRITE(X(p)) ;

    r e p e a t

    f or q e { 1 , . . . , n } do Y ( q ) : = READ(. t 9 ) ;i f X = Y t h e n r e t u r n (X ) ;

    e l s e X:= Y ;e n d - r e p e a t

    en d ;

    Procedure SM-HELP-COMMUNICATE(X) ;I n p u t X: a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ;b e g i n

    w h i l e n o t a l l p r oc e s so r s d ec i d ed d o n o t e r a se t h e c o n t en t o f Rp ;en d ;

    Fi g. 2 . The shared-memory communi cation procedure s for processor p T h e a t o m i c r e g i s t e r o f p i sdenoted by R .

  • 8/3/2019 Partial Equivalence

    8/19

    2 8 A. Bar-Noy and D . D o l e vProcedure MP-COMMUNICATE(X) ;I n p u t X a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ;Output X a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ;v a r c : a c o u n t e r ;

    q : a processor name ;Y : a v e c t o r o f l e n g t h n ;b e g i n

    1 . BROADCAST(X) ;C : = 1 ;

    2 . upon r e c e i v i n g Y from q doi f Y< X t h e n g o t o 2 ;e l s e i f Y = Xt h e n b e g i n

    c :=c+1 ;i f c < n - t t h e n g o t o 2 ;

    e l se r e tu rn ( X ) ;

    en d ;

    else ifY Xt h e n b e g i nfor all j s . t . X (j)- < Y ( t ) do XU) : = Y ( i ) ;

    g o t o 1 ;

    en d ;

    en d ;

    Procedure MP-HELP-COMMUNICATE(X) ;I n p u t X : a c o m m u n i c a t i o n v e c t o r o f l e n g t h n ;v a r q : a processor name ;Y a v e c t o r o f l e n g t h n ;b e g i n

    w h i l e n o t a l l p ro c e ss o r s d e c id e d d o

    upon r e c e i v i n g Y from q doi f Y

  • 8/3/2019 Partial Equivalence

    9/19

    Partial Equivalence Between Shared-Memory and Message-Passing 2 9

    Procedur e MP-COMMUNICATE, pro cessorp has a candidate vector . T h e v e c t o r

    b e c o m e s t h e o u t p u t w h e n p r o c e s s o r p r e c e i v e s n - t - 1 v e c t o r s i d e n t i c a l t o i t s

    o w n c a n d i d a t e . I f p r o c e s s o r p r e c e i v e s a v e c t o r t h a t i s m o r e r e c e n t i n o n e o f i t s

    e n t r i e s a c c o r d i n g t o {, i t u p d a t e s a l l s u c h e n t r i e s i n i t s c a n d i d a t e v e c t o r a n d

    r e s u m e s c o l l e c t i n g i d e n t i c a l v e c t o r s . In Procedure MP-HELP- COMMUNICATE,

    p r o c e s s o r p c o n t i n u e s t o u p d a t e i t s c o m m u n i c a t i o n v e c t o r a n d t o b r o a d c a s t m o r e

    u p d a t e d v e r s i o n s o f i t s c o m m u n i c a t i o n v e c t o r u n t i l a l l o t h e r p r o c e s s o r s m a d e t h e i r

    d e c i s i o n . The command BROAD CAST (X) stands for se nding the message X to

    a l l o t h e r p r o c e s s o r s .

    W e n o t e t h a t i n b o t h m o d e l s i t i s o f t e n i m p o s s i b l e t o d e t e r m i n e w h e t h e r a l l

    t h e p r o c e s s o r s h a v e m a d e t h e i r d e c i s i o n . O b v i o u s l y , r u n n i n g P r o c e d u r e S M -

    H ELP- C OMMUNICATE and Procedure MP-H ELP- C OMMUNICATE for-

    e v e r i s e n o u g h . H o w e v e r , i f t h e r e e x i s t s a w a y t o k n o w t h a t a l l t h e p r o c e s s o r s h a v e

    d e c i d e d , t h e n t h e p r o c e s s o r s m a y q u i t .

    W e n e e d t o p r o v e t h a t t h e s e p r o c e d u r e s c o m p l y w i t h t h e g l o b a l - o r d e r

    r e q u i r e m e n t a n d t h e d e a d l o c k - f r e e r e q u i r e m e n t .

    L e m m a 4 . 1 . S u p p o s e t h a t X , a n d X 2 w e r e t h e c o m m u n i c a t i o n v e c t o r s o f p r o c e s s o r

    p i n t i m e s t , < t 2 . T h e n X , - < X 2 .

    P r o o f . In both Proce dures SM-COMMUNICATE and MP-C OMMUNI-

    C A T E , a p r o c e s s o r u p d a t e s a n e n t r y i n i t s c o m m u n i c a t i o n v e c t o r o n l y b y m o r e

    u p d a t e d i n f o r m a t i o n ( a c c o r d i n g t o - < ) . T h e r e f o r e , a l l t h e v e c t o r s p h e l d a r e t o t a l l y

    o r d e r e d u n d e r - C . 0Lemma 4 . 1 i m p l i e s t h a t b o t h p r o c e d u r e s m e e t t h e g l o b a l - o r d e r r e q u i r e m e n t .

    L e m m a 4. 2 ( G l o b a l - O r d e r ) . L e t X a n d X ' b e t w o o u t p u t v e c t o r s h e l d b y p r o -

    c e s s o r s p a n d q , r e s p e c t i v e l y . T h e n e i t h e r X - < X ' o r X ' - < XP r o o f o f t h e S h a r e d - M e m o r y M o d e l . A s s u m e t o t h e c o n t r a r y t h a t t h e l e m m a i s

    f a l s e . T h e n t h e r e e x i s t 1 an d k s u c h t h a t X (l ) - < Y ( I ) a n d Y ( k ) - < X ' ( k) . D e n o t e b y

    t , , t 2 i t 3 , t 4 t h e t i m e s t h a t p r e a d R i n t h e f i r s t s c a n o f X, r e a d R k i n t h e f i r s t s c a no f X , r e a d R, i n t h e s e c o n d s c a n o f X , a n d r e a d 9 , i n t h e s e c o n d s c a n o f X,

    r e s p e c t i v e l y . S i m i l a r l y d e f i n e s , , s 2 , s 3 , s 4 f o r q .

    B y d e f i n i t i o n , b o t h t , and t 2 a r e s m a l l e r t h a n b o t h t 3 a n d t 4 a n d b o t h s , a n d

    s 2 a r e s ma l l e r th a n b ot h s 3 a n d s 4 . S i n c e X ( l ) - < X ' ( l ) , i t f o l l o w s t h a t q , i n t i m e s , ,

    f o u n d i n 9 1 a m o r e u p d a t e d v e r s i o n o f p r o c e s s o r l ' s c o m m u n i c a t i o n v a r i a b l e s t h a n

    t h e v e r s i o n p f o u n d i n t i m e t 3 . C o n s e q u e n t l y , t 3 < s , . S i m i l a r l y , s i n c e Y ( k ) - < X ( k )

    i t f o l l o w s t h a t s 4 < t 2 . C o m b i n i n g t h e t w o y i e l d s t 3 < t 2 ; a c o n t r a d i c t i o n .

    N o t e t h a t t h e p r o o f h o l d s e v e n w h e n p and q r e a d t h e r e g i s t e r s . 4 i and GJc ' k

    n o t i n t h e s a m e o r d e r . T h i s i s t r u e s i n c e t h e p r o o f i s v a l i d i n d e p e n d e n t o f t h e

    o r d e r b e t w e e n t h e t w o t i m e s i n e a c h o f t h e f o l l o w i n g f o u r p a i r s : t , and t 2 , s, an d

    s 2 , t 3 and t 4 , a n d s 3 and s 4 . M o r e o v e r , a p r o c e s s o r m a y r e a d t h e n r e g i s t e r s i n

    t w o d i f f e r e n t s c a n s i n a d i f f e r e n t o r d e r a n d t h e p r o o f s t i l l h o l d s . El

  • 8/3/2019 Partial Equivalence

    10/19

    3 0 A. Bar-Noy and D . D o l e vProof fo r the Message-Passing Model . Both proces sors p an d q had n - ti d e n t i c a l v e c t o r s f o r Xan d X' . S i n c e n > 2t t h e r e e x i s t s a p r o c e s s o r k , t h e v e c t o ro f w h i c h b e l o n g s t o b o t h s e t s o f v e c t o r s . By Lemma 4 . 1 t h e v e c t o r s h e l d b y a n y

    p r o c e s s o r a r e t o t a l l y o r d e r e d a n d t h e r e f o r e e i t h e r X -< X' or X' - < X RThe next lemma shows that both procedures m eet the deadlock-f ree req uire-

    ment .

    Lemma 4 .3 (Deadlock-Free) . S u p p o s e t h a t s o m e s e t o f n o n f a u l t y p r o c e s s o r s , 9 ,

    have not yet dec ided. Let Xj b e t h e l a s t s t a b l e v e c t o r o u t p u t b y a n y p r o c e s s o r .

    T h e n e v e n t u a l l y o n e o f t h e p r o c e s so r s i n . 9 wi l l o ut p u t X1+1 .Proof fo r the Shared-Memory Model . All the nonfaulty process ors that have

    d e c i d e d w i l l n e v e r c h a n g e t h e c o n t e n t of t h e i r r e g i s t e r . A l l t h e o t h e r n o n f a ul t y

    processors will eventually invoke Procedure SM-COMMUNICATE and execute

    i t s f i r s t l i n e . A f t e r t h a t p o i n t n o n e o f t h e m w i l l c h a n g e t h e c o n t e n t o f i t s r e g i s t e r

    ' u n l e s s i t o u t p u t s a s t a b l e v e c t o r a n d i t h a s n o t y e t d e c i d e d . T h e r e a f t e r , t h e f i r s t

    p r o c e s s o r i n 9 t o c o m p l e t e t w o s c a n s w i l l o u t p u t a s t a b l e v e c t o r . 0Pr oof for the Message-Passing Model . A n o n f a u l t y p r o c e s s o r p t h a t h a s a l r e a d y

    decid ed will neve r change the value of X(p) in its commun ication vector . A

    n o n f a u l t y p r o c e s s o r p t h a t h a s n o t y e t d e c i d e d w i l l e v e n t u a l l y i n v o k e P r o c e d u r e

    MP-CO MMUNICAT E and will not change the value o f X ( p ) in its communica-

    tion vector unl ess it outputs a stable vector . T h e r e f o r e , e v e n t u a l l y , f o r e a c h

    n o n f a u l t y p r o c e s s o r p , t h e v a l u e o f X(p) i n i t s c o m m u n i c a t i o n v e c t o r i s f i x e d .

    Recall that processors that have decid ed, invok e MP-HEL P-COMMUNI-CATE. I n a n y c a s e , a t l e a s t n - t p r o c e ss o r s p a r ti c i p a t e i n t h e p r o c es s o f s e n d i n gand receiving messages . T h e s e n - t p r o c e s s o r s w i l l e v e n t u a l l y g e t e a c h o t h e r ' s

    v e c t o r a n d w i l l h a v e i d e n t i c a l v e c t o r s . If p has decided already and outputs a

    s t a b l e v e c t o r , i t w i l l n o t c h a n g e X(p) in its communic ation vector . T h e r e f o r e ,

    n e c e s s a r i l y o n e o f t h e u n d e c i d e d n o n f a u l t y p r o c e s s o r s w i l l o u t p u t a s t a b l e v e c t o r . F j

    5 . The Consensus Problem

    D e f i n i t i o n 5 . 1 . In the c o n s e n s us p r o b l e m , e a c h p r o c e s so r h a s a n i n i t i a l b i n a r y

    v a l u e . The processors should dec ide on a binary value under the followi ng

    requireme nts :

    1 . N o t w o p r o c e s s o r s d e c i d e o n d i f f e r e n t v a l u e s .

    2 . T h e d e c i s i o n v a l u e i s s o m e p r o c e s s o r ' s i n i t i a l v a l u e .

    T h i s p r o b l e m i s a v e r y b a s i c c o o r d i n a t i o n p r o b l e m . A n u m b e r o f p a p e r s s o l v e

    t h i s p r o b l e m a n d t h e r e l a t e d B y z a n t i n e G e n e r a l s p r o b l e m i n d i f f e r e n t m o d e l s ( s e e

    [ F i ] f o r a s u r v e y o f e a r l y w o r k ) .

    A s p n e s a n d H e r l i h y [ A H ] d e s c r i b e d a r a n d o m i z e d a l g o r i t h m f o r t h e c o n s e n s u s

  • 8/3/2019 Partial Equivalence

    11/19

    Partial Equivalence Between Shared-Memory and Message-Passing 3 1

    proble m in the shared-me mory model . T h e i r a l g o r i t h m i s w a i t - f r e e a n d i t u s e s a

    weak shared coin f o r t h e r a n d o m c h o i c e s . T h e e x p e c t e d n u m b e r o f r o u n d s f o r t h e

    c o i n p r o c e d u r e a n d f o r t h e c o n s e n s u s a l g o r i t h m i s 0(n 2 ) . I t h a p p e n s t h a t t h e i r

    c o n s e n s u s a l g o r i t h m a n d t h e p r o c e d u r e t h a t p r o d u c e s t h e w e a k s h a r e d c o i n c a n

    b e b a s e d o n t h e s c h e m a t i c a l g o r i t h m . T h e r e f o r e , t h e i r s o l u t i o n c a n a l s o b e a p p l i e d

    t o t h e m e s s a g e - p a s s i n g m o d e l d e s c r i b e d i n S e c t i o n 2 .2 .

    I n t h e m e s s a g e - p a s s i n g m o d e l , t h i s r e s u l t i m p r o v e s t h e b e s t p u b l i s h e d r e s u l t

    o f B e n - O r [ B ] , t h e c o m p l ex i t y o f w hi c h i s O ( 2 " ) e x p e c t e d n u m b e r o f r o u n d s . ( A n

    u n p u b l i s h e d r e s u l t o f F e l d m a n [ F e ] s t a t e s t h a t i f n > 4 t , t h e n t h e r e i s a n a l g o r i t h m

    w i t h a c o n s t a n t e x p e c t e d n u m b e r o f r o u n d s . )

    5 . 1 . T he W ea k Shared C o i n

    I n t h i s s e c t i o n w e d e s c r i b e t h e c o i n p r o c e d u r e o f [ A H ] i n t h e f r a m e w o r k o f

    Algori thm SCHEMATIC . A s p n e s a n d H e r l i h y [ A H ] d e f i n e t h e i r c o i n u s i n g a n

    a b s t r a c t i o n f o r c o u n t e r s . H o w e v e r , i t i s n o t h a r d t o v e r i f y t h a t o u r p r e s e n t a t i o n

    i s e q u i v a l e n t . T h e y u s e a w e a k s h a r e d c o i n w h i c h i s d e f i n e d a s f o l l o w s .

    D e f i n i t i o n 5 . 2 . For a > 1 , a w e a k s h a r e d c o i n h a s t h e f o l l o w i n g t w o p r o p e r t i e s :

    1 . A p r o c e s s o r f l i p s r c { 0 , 1 } w i t h p r o b a b i l i t y a t m o s t( a + 1 ) / 2 a .

    2 . W i t h p r o b a b i l i t y g r e a t e r t h a n ( a - 1 ) / 2 a a l l t h e p r o c e s s o r s f l i p t h e s a m ev a l u e .

    The parameter a i s c a l l e d t h e b i a s p a r a m e t e r .

    T h e i d e a u n d e r l y i n g P r o c e d u r e C O I N i s a s f o l l o w s . T h e p r o c e s s o r s , t o g e t h e r ,

    perform a random walk o f a n a b s t r a c t c u r s o r o n t h e l i n e . T h e c u r s o r i n i t i a l l y p o i n t s

    t o z e r o , a n d e a c h p r o c e s s o r c a n m o v e t h e c u r s o r o n e u n i t t o t h e r i g h t o r t o t h e

    l e f t . A p r o c e s s o r f l i p s 1 o r 0 i f t h e c u r s o r p o i n t s t o t h e r i g h t o f an o r t o t h e l e f t

    o f -an, r e s p e c t i v e l y , w h e r e a i s t h e b i a s p a r a m e t e r . I n t u i t i v e l y , t h e o n l y w a y t h e

    a d v e r s a r y c a n b i a s t h e o u t c o m e o f t h e c o i n t o w a r d s o m e e c - { 0 , 11, i s b y p r e v e n t i n g

    a s m a n y p r o c e s s o r s a s p o s s i b l e t h a t t r y t o m o v e t h e c u r s o r t o t h e o t h e r d i r e c t i o n

    to do so . In the shared-memory mode l the adversary can delay the move

    o f n - 1 p r o c e s s o r s a n d i n t h e m e s s a g e - p a s s i n g m o d e l i t c a n d e l a y t h e m o v e of t

    p r o c e s s o r s . H o w e v e r , i n t h i s c a s e t h e r e m a i n i n g p r o c e s s o r s c o n t i n u e t h e r a n d o m

    walk . T h i s l i m i t s t h e i n f l u e n c e o f t h e a d v e r s a y o n t h e f i n a l o u t c o m e o f t h e c o i n s

    b e i n g f l i p p e d .

    T h e c o d e f o r P r o c e d u r e C O I N a p p e a r s i n F i g u r e 4 . T h e c o d e i s d e s c r i b e d f o r

    p r o c e s s o r p t h a t f l i p s t h e coinnumber coin and co mputes the weak shared coinc o i n v a l u e w i t h t h e b i a s p a r a m e t e r a . T h e r o l l of coinnumber is t o d i s t i n g u i s h

    b e t w e e n d i f f e r e n t c a l l s t o P r o c e d u r e C O I N . T h e l o c a l f u n c t i o n f l i p r e t u r n s o n e o f

    t h e v a l u e s + 1 o r - 1 , e a c h w i t h p r o b a b i l i t y 1 / 2 . T h e l o c a l v a r i a b l e round

    g e n e r a t e s t h e l o c a l o r d e r r e q u i r e d b y t h e l o c a l - o r d e r a s s u m p t i o n ( A s s u m p t i o n 3 . 1 ) .

    T h e v a l u e o f t h e v a r i a b l e l o c a l w a l k i s the sum o f a l l t h e l o c a l c o i n s p h a s f l i p p e d .

    E a c h e n t r yo f

    t h e c o m m u n i c a t i o n v e c t o r i s c o m p o s e d o f t h r e e f i e l d s a s s o c i a t e d w i t h

  • 8/3/2019 Partial Equivalence

    12/19

    3 2 A. Bar-Noy and D . D o l e vProcedure COIN ( c o i n n u m b e r , a , c o i n v a l u e ) ;I n p u t coinnumber : a c o u n t e r ;

    a : a b i a s p a r a m e t e r ;

    Output c o i n v a l u e : 1 o r - 1 ;v a r l o c a l w a l k , g l o b a l w a l k : i n t e g e r s ;

    round : a c o u n t e r ;

    f l i p : a r e a l c o i n ;X: a c o m m u n i c a t i o n v e c t o r ;(X. c o i n n u m b e r , X . r o u n d , X . l o c a l w a l k ) : t h e t h r e e f i e l d s i n e a c h e n t r y o f X

    b e g i n

    round : = l o c a l w a l k : = g l o ba l w a l k : = 0 ;

    f o r e a c h p r o c e s s o r q d o X ( q ) : = ( c o i n n u mb e r , 0 , 0 ) ;

    w hi le - a n < - g l ob a l w a l k < - a n do

    round : = r o u n d + 1 ;

    ( * i n c r e m e n t s o r d e c r e m e n t s walk w i t h p r o b a b i l i t y 1 / 2 * )

    l o c a l wa l k : = l o c a l wa l k + f l i p ( + 1 , - 1 ) ;

    X ( p ) : = ( c o i n n u m b e r , r o u n d , l o c a l w a l k ) ;COMMUNICATE(X) ;g l o b a l w a l k : = Y, . X ( l ) . l o c a l w a l k ;

    e n d - w h i l e

    i f g l o b a l w a l k > a n t h e n c o i n v a l u e :=1 ;

    i f globalwalk < -an t h e n c o i nv a lu e : = 0 ;HELP-COMMUNICATE(X) ;e n d ;

    F i g . 4 . P r o c e d u r e C O I N f o r p r o c e s s o r p w i t h b i a s p a r a m e t e r a .

    t h e c o m m u n i c a t i o n v a r i a b l e s : coinnumber, round, and localwalk . T h e v a l u e o f t h e

    v a r i a b l e globalwalk is t h e s u m o f a l l t h e localwalk f i e l d s i n p ' s c o m m u n i c a t i o n

    v e c t o r . Proced ure C OMMUNICATE is ei ther Proc edure SM-COMMUNICATE

    o r P r o c e d u r e M P - C O M MU N IC A T E a n d P r o c e d u r e H E L P - C O M M UN I C A T E

    is either Procedure SM-HELP- CO MMUNICATE or P rocedure MP-HELP -COMMUNICATEA t t h i s s t a g e , w e p r o v e t h a t P r o c e d u r e C O I N i n d e e d p r o d u c e s a w e a k s h a r e d

    c o i n . W e s t a t e t h e l e m m a s n e e d e d a n d o m i t t h e p r o o f s , a s t h e y a r e s i m i l a r t o t h e i r

    counterpart proofs in [AH] (Lemma 15 through Theorem 19) .

    Denote by Hand T t h e n u m b e r o f 1 a n d - 1 g e n e r a t e d b y a l l t h e p r o c e s s o r sin some run of Procedure COIN. The global-order lemma (Lemma 4. 2 ) i m p l i e s

    Lemma 5 . 1 w h i c h y i e l d s C o r o l l a r i e s 5 . 1 a n d 5 . 2 .

    L e m m a 5 . 1 . Let 1 < l3 be a real number . If, for some processor, H - T > l3n(resp . T - H > /3n), then at that time H - T > - ( / 3 - 1 ) n ( r es p . T - H >- (/3 - 1)n) .C o r o l l a r y 5 . 1 . If H- T > (a + 1)n (resp . T - H > (a + 1)n), then all r emainingprocessors even tually fl i p 1 ( r e s p . 0) .

    C o r o l l a r y 5 . 2 . If some processor flips 1 (resp . 0 ) , t h e n a t t h a t t i m e H - T > - ( a - 1)n(resp . T- H >- (a - 1)n) .

  • 8/3/2019 Partial Equivalence

    13/19

    Partial Equivalence Between Shared-Memory and Message-Passing 3 3

    T h e n e x t t w o l e m m a s s h o w t h e t w o p r o p e r t i e s o f t h e w e a k s h a r e d c o i n ( s e e

    D ef i n i ti o n 5 . 2 ) .

    Lemma 5 . 2 . T h e a d v e r s a r y c a n f o r c e a p r o c e s s o r t o f l i p s w i t h p r o b a b i l i t y a t m o s t( a + 1 ) / 2 a .

    Lemma 5. 3 . W i t h p r o b a b i l i t y g r e a t e r t h a n ( a - 1 ) / 2 a a l l t h e p r o c e s s o r s f l i p t h es a m e v a l u e .

    T h e c o m p l e x i t y o f t h i s p r o c e d u r e i s s t a t e d i n t h e n e x t l e m m a . I t c a n b e p r o v ed

    based on the deadlock-fr ee lemma (Lemma 4 . 3 ) .

    Lemma 5 . 4 . T h e e x p e c t e d n u m b e r o f r o u n d s o f P r o c e d u r e COIN i s 0((a + 1 ) 2 n 2 ) .Combin ing Lemmas 5 . 2 , 5 . 3 , a n d 5 . 4 t o g e t h e r y i e l d s t h e f o l l o w i n g t h e o r e m .

    Theorem 5 . 1 . P r o c e d u r e COIN p r o d u c e s a w e a k s h a r e d c o i n w i t h O((a + 1 ) 2 n 2 )e x p e c t e d n u m b e r o f r o u n d s .

    5 . 2 . T h e C o n s e n s u s A l g o r i t h m

    I n t h i s s e c t i o n w e d e s c r i b e t h e c o n s e n s u s a l g o r i t h m o f [ A H ] i n t h e f r a m e w o r k o f

    A l g o r i th m S C H E M A T I C . A g a i n , o u r p r e s e n t a t i o n i s n o t t h e s a m e a s t h a t o f

    [ A H ] b u t i t i s n o t h a r d t o v e r i f y t h a t b o t h p r e s e n t a t i o n s a r e e q u i v a l e n t .

    Algorithm CONSENSUS for p rocessor p w i t h i n i t i a l v a l u e v , b i a s p a r a m e t e r

    a f o r c o i n s, a n d a d e c i s i o n v a lu e c o n s a p p e a r s i n F i g u r e 5 . I n t h e f i r s t r o u n d ,

    p r o c e s s o r p s u g g e s t s i t s i n p u t v a l u e a s t h e d e c i s i o n v a l u e . I n l a te r r ou n d s , p e i t h er

    d e c i d e s o n t h i s v a l u e o r s u g g e s t s s o me v a l u e a g a i n a c c o r d i n g t o t h e f o l l o w i n g

    rul es . I f , b a s e d o n p ' s k n o w l e d g e , i t s r o u n d i s t h e m a x i m a l r o u n d a n d t h e r o u n d s

    o f a l l t h e p r o c e s s o r s t h a t d i s a g r e e with p ' s v a l u e t r a i l b y a t l e a s t t w o , t h e n p d e c i d e so n i t s v a l u e . E l s e, i f a l l th e p r o c e s so r s w i t h m a x i m u m ro u n d a g r e e on the same

    v a l u e , e , t h e n p a d o p t s e a n d s u g g e s t s i t i n i t s n e x t r o u n d . Ot h er w i s e, i t s u g ge s ts ,i n i t s n e x t r o u n d , a n e w v a l u e w h i c h i s t h e v a l u e o f t h e w e a k s h a r e d c o i n f l i p p e d

    b y P r o c e d u r e C O M MU N IC A T E .

    I n t h e c o d e o f t h e a l g o r i t h m , t h e v a r i a b l e round g e n e r a t e s t h e l o c a l o r d e r

    required b y the local-order assumption (Assumption 3 . 1 ) . Each entry of the

    c o m m u n i c a t i o n v e c t o r i s c o m p o s e d o f t w o f i e l d s a s s o c i a t e d w i t h t h e c o m m u n i c a -

    t i o n v a r i a b l e s : round an d v . T h e v a l u e o f t h e v a r i a b l e m a x r o u n d i s the maximu m

    o f a l l t h e round f i e l d s i n t h e c o m m u n i c a t i o n v e c t o r . P r o c e d u r e C OMMUNI CA T E

    is either Procedure S M-COMMUNICATE or Proced ure MP-COMMUNICATE

    and procedure H ELP-COMMUNICATE is either Procedure SM-HELP-C OM-MUNICATE or Procedurre MP-HELP-COMMUNICATE .Note that both Algorithm CONSENSUS and Pro cedure COIN call Proce-dures COMMUNICATE and HELP-COMMUNICATE . F u r t h e r m o r e , a p r o -

    c e s s o r w h i l e f l i p p i n g o n e c o i n m a y n e e d t o h e l p o t h e r p r o c e s s o r s t o f l i p e a r l i e r

  • 8/3/2019 Partial Equivalence

    14/19

    34 A. Bar-Noy and D . D o l e vAlgorithm CONSENSUS ( v , a , c o n s ) ;I n p u t v : a n i n i t i a l b i n a r y v a l u e ;

    a : a b i a s p a r a m e t e r ;

    Output c o n s : a d e c i s i o n b i n a r y v a l u e ;

    v a r e : a b i n a r y v a l u e ;

    round, maxround : c o u n t e r s ;

    q : a processor name ;X: a c o m m u n i c a t i o n v e c t o r ;(X.round, X. v a l u e ) : t h e t w o f i e l d s i n e a c h e n t r y o f X

    b e g i n

    r o u n d := ma x r o u n d := 0 ;

    f o r e a c h p r o c e s s o r q d o X(q) : = ( 0 , - 1) ;w h i l e (round 0 maxround) o r (3gX(q).value 0 v a n d X(q).round >_ round - 1) do( * s t o p o n l y i f r o u n d i s a m a x i m u m a n d a l l t h a t d i s a g r e e t r a i l b y a t l e a s t 2 * )

    round := round + 1 ;

    X(p) :=(round, v) ;COMMUNICATE(X) ;maxround := max

    i s 9 s n {X(q) . round} ;

    ( * i f a l l p r o c e s s o r s w i t h r o u n d = ma x r o u n d a g r e e o n t h e s a m e v a l u e * )

    i f 3 e s . t .d y , x ( y ) . . a n n d , , , 0 u n d X( q)

    .value = s

    t h e n v : = s ; ( * a d o p t s t h e m a j o r i t y v a l u e * )

    e l s e v := COIN(round + 1, a) ; ( * f l i p a w e a k s h a r e d c o i n f o r v * )

    e n d - w h i l e

    ( * H e r e , (round = maxround) and ( X ( q ) , v a l u e # v i f f X ( q ) .round < round - 1 ) * )cons := v ;HELP-COMMUNICATE(x) ;

    e n d ;

    F i g . 5 . Algorithm CONSENSUS for processor p w i t h i n i t i a l v a l u e v a n d b i a s p a r a m e t e r a.

    c o i n s . This means that a processor while executing Procedure COMMUNICATE

    is concurrently ex ecuting several instances of Procedure H ELP-COMMUNI-CATE. F o r s i m p l i c i t y , w e o m i t t h e m e c h a n i s m t h a t e n a b l e s p r o c e s s o r s t o d i s t i n -g u i s h be t w e e n d i f fe r e n t c a l l s a n d to h a n d l e d i f fe r e n t c a l l s . W e j u s t r e m a r k t h a t i t

    c a n b e d o n e u s i n g t h e v a r i a b l e round o f P r o c e d u r e c o i n a n d t h e v a r i a b l e round o f

    A l g o r i th m C O N S E N S US .

    W e o m i t t h e p r o o f s o f t h e f o l l o w i n g l e m m a s s i n c e t h e y a r e s i m i l a r t o t h e i r

    counterpart proofs in [AH] (Lemma 1 through Theorem 6 and Corollary 14) .

    T h e y a r e s t a t e d s o a s t o e m p h a s i z e t h e w a y t h e g l o b a l - o r d e r r e q u i r e m e n t a n d t h e

    d e a d l o c k - f r e e r e q u i r e m e n t s a r e u s e d .

    The global-order lemma, Lemma 4 . 2 , i m p l i e s t h e f o l l o w i n g t w o l e m m a s .

    Lemma 5. 5 . I n a c e r t a i n r o u n d a t m o s t o n e v a l u e c a n b e a d o p t e d .Lemma 5. 6 . I f a p r o c e s s o r d e c i d e s o n a i n r o u n d r , t h e n n o o t h e r p r o c e s s o r s u g g e s t s1 - s i n r o u n d r .

    T h e f o l l o w i n g c o r o l l a r y g u a r a n t e e s t h e f i r s t r e q u i r e m e n t o f t h e c o n s e n s u s

    p r o b l e m ( D e f i n i t i o n 5 . 1 ) .

  • 8/3/2019 Partial Equivalence

    15/19

    Partial Equivalence Between Shared-Memory and Message-Passing 3 5

    C o r o l l a r y 5 . 3 . If a p r o c e s s o r d e c i d e s o n a i n r o u n d r , t h e n a l l t h e o t h e r p r o c e s s o r s

    d e c i d e o n s n o l a t e r t h a n r o u n d r + 1 .

    The deadlock-free lemma, Lemma 4 . 3 , g u a r a n t e e s t h e s e c o n d r e q u i r e m e n t o f

    t h e c o n s e n s u s p r o b l e m ( D e f i n i t i o n 5 . 1 ) .

    Lemma 5 . 7 . If a l l t h e p r o c e s s o r s h a v e t h e s a m e i n i t i a l v a l u e , t h e n t h e y a l l d e c i d eo n t h i s v a l u e a f t e r t h e s e c o n d r o u n d .

    The expected number of rounds for Algorithm CONSENSUS depends on the

    t y p e o f c o i n u s e d . I f t h e p r o c e s s o r s s h a r e a p e r f e c t ( n o n b i a s e d ) g l o b a l c o i n , t h e n

    t h e e x p e c t e d n u m b e r o f r o u n d s i s c o n s t a n t . O n t h e o t h e r h a n d , i f e a c h p r o c e s s o r

    f l i p s a l o c a l c o i n , t h e n t h e a d v e r s a r y c a n f o r c e t h e e x p e c t e d n u m b e r o f r o u n d s t o

    b e 0(2") . H e r e , t h e w e a k s h a r e d c o i n ( S e c t i o n 5 . 1 ) i s u s e d, w h i c h, b y t h e d e a d l oc k -

    free lemma (Lemma 4 . 3 ) , i s s u f f i c i e n t t o g u a r a n t e e a c o n s t a n t e x p e c t e d n u m b e r o f

    r o u n d s .

    L e m m a 5 . 8 . The expected number o f r o u n d s o f A l g o r i t h m s CONSENSUS i sc o n s t a n t .

    Combining C orollary 5.3, Lemma 5 .7, Lemma 5 . 8 , a n d T h e o r e m 5. 1 t o g e t h e r

    y i e l d s t h e f o l l o w i n g t h e o r e m .

    Theorem 5 . 2 . A l g o r i t h m s CONSENSUS u s i n g P r o c e d u r e C OI N, s o l v e s t h e c o n -s e n s u s p r o b l e m i n 0 ( n 2 ) e x p e c t e d n u m b e r o f r o u n d s .

    6 . The Renaming Problem

    D e f i n i t i o n 6 . 1 . I n t h e r e n a m i n g p r o b l e m , e a c h p r o c e s s o r p i n i t i a l l y h a s a d i s t i n c t

    old name taken from some (pos sibly large) ordere d domain . T h e g o a l o f t h e

    p r o c e ss o r s i s t o s e l ec t a n e w n a m e fr o m a s p a ce o f s i ze N , s o t h at e v er y t w o se l e c t ed

    n e w n a m e s a r e d i s t i n c t .

    T h e v a l u e o f N d o e s n o t d e p e n d o n t h e o r i g i n a l n a m e s , b u t o n l y o n n . Fort h e s a k e o f s i m p l i c i t y , i n t h e d e s c r i p t i o n o f t h e a l g o r i t h m t h e p r o c e s s o r s a r e s t i l l

    i d e n t i f i e d w i t h t h e n u m b e r s l , . . . , n . H o w e v e r , t h i s n u m b e r i n g i s n o t c o m m o n t o

    a l l t h e p r o c e s s o r s , o t h e r w i s e t h e y c a n s o l v e t h e p r o b l e m b y s e l e c t i n g t h e s e n u m b e r s .

    N e v e r t h e l e s s , t h e p r o c e s s o r s a r e s t i l l a b l e t o c o m p a r e e n t r i e s o f t h e i r o w n

    c o m m u n i c a t i o n v e c t o r a n d o t h e r c o m m u n i c a t i o n v e c t o r s . They compare them by

    t h e o l d n a m e p a r t o f t h e e n t r i e s . T h e a l g o r i t h m g u a r a n t e e s t h a t t h e c o m m u n i c a t i o n

    v a r i a b l e s w i l l a l w a y s c o n t a i n t h e o l d n a m e .

    T h e m o t i v a t i o n a n d t h e i m p o r t a n c e o f t h i s p r o b l e m a r e w e l l e x p l a i n e d i n t h e

    paper [ABD + ] , which presented two solu tions that are based on Algor ithmSCHEMATIC. I n t h i s s e c t i o n w e p r e s e n t t h e s i m p l e a l g o r i t h m o f [ABD + ] ,w h i c h s o l v e s t h e r e n a m i n g p r o b l e m w i t h a n e w n a m e - s p a c e o f s i z e 0 ( n 2 ) .

  • 8/3/2019 Partial Equivalence

    16/19

    3 6

    Algorithm RENAMING (ID, NEWID) ;I n p u t ID : t h e o l d n a m e o f p ;Output NEWID : the new name of p ;v a r S: a s e t o f o l d n a m e s ;

    r ; i n t e g er ;

    q : a l o c a l n a m e f o r p r o c e s s o r s ;X v e c t o r o f n old names;b e g i n

    fo r q : = 1 t o n do X ( q) : = 0 ;

    X ( p ) := ID ;COMMUNICATE(X) ;S: = t h e s e t of t h e o l d n a me s t h a t a p p e a r i n Xr : = t h e r a n k o f ID i n SNEWID : = I SI I+r ;HELP-COMMUNICATE(X) ;

    e n d ;

    F i g . 6 . Algori thm RENAMING for proce ssor p .

    A. Bar-Noy and D . D o l e v

    T h e g o a l o f e v e r y p ro c e s s o r i s t o l e a r n t he n a m e s o f o t h e r p r oc e s s o r s . D u e t o

    the asynchronous fail-stop en vironme nt, it cannot do it. The idea behind

    Algo rithm RENAMING is that processo rs sele ct their new names accor ding to

    s o m e s e t s o f o l d n a m e s o n l y i f a n y t w o s u c h s e t s a r e c o m p a r a b l e ( o n e s e t i s a

    s u b s e t o f t h e o t h e r s e t ) . T h i s c o n d i t i o n c a n b e a c h i e v e d b y o n e c a l l t o P r o c e d u r e

    COMMUNICATE (either Procedure SM-COMMUNICATE or Proce dure MP-COMMUNICATE).Algorithm RENAMING appears in Figu re 6 . T h e c o m m u n i c a t i o n v a r i a b l e s

    o f a p r o c e s s o r i n t h i s s o l u t i o n c o n t a i n o n l y t h e o l d n a m e o f t h i s p r o c e s s o r . H e r e

    p r o c e s s o r s c o m p a r e t w o e n t r i e s o f t w o ve c t o r s b y t h e i r c o n t e n t ( o l d n a m e s ) a n d

    n o t b y t h e i r i n d e x . I f a p r o c e s s o r d o e s n o t h a v e a n e n t r y c o n t a i n i n g s o m e o l d

    n a m e a n d i t s e e s t h i s o l d n a m e i n a n o t h e r v e c t o r , i t d e d u c e s , t h a t i t h a s l e s s u p d a t e d

    i n f o r m a t i o n . N o t e t h a t t h e r e a r e t w o p o s s i b l e v a l u e s t o e a c h e n t r y : ei ther the nul l

    v a l u e o r a n o l d n a m e o f s o m e p r o c e s s o r .

    A g a i n , s i n c e p r o c e s s o r s c a n n o t q u i t b e f o r e a l l t h e o t h e r p r o c e s s o r s m a k e t h e i r

    decision, they call Procedure H ELP-COMMUNICATE after selecting their new

    name .

    Denote by S k t h e s e t o f t h e o l d n a m e s t h a t a p p e a r i n t h e k t h s t a b l e v e c t o rX . T h e f o l l o w i n g a r e t w o s i m p l e c o r o l l a r i e s o f t h e g o b a l - o r d e r l e m m a ( L e m m a4 . 2 ) .

    C o r o l l a r y 6 . 1 . I f l < i < j , t h e n S , c ~ S ; .

    C o r o l l a r y 6 . 2 . F o r e v e r y 1, 1 < l < n , if I S i I _ I S ; I = 1, then S i = S , .

    In the algorithm, each processorp invokes Procedure COMMUNICATE only

    o n c e a n d t h e n d e c i d e s a c c o r d i n g t o t h e o u t p u t s t a b l e ve c t o r X L e t l b e t h e n u m b e r

  • 8/3/2019 Partial Equivalence

    17/19

    Partial Equivalence Between Shared-Memory and Message-Passing 3 7

    o f o l d n a m e s t h a t a p p e a r i n X , a n d l e t r b e t h e r a n k o f p ' s o l d n a m e a l o n g t h e s e

    o l d IDs . T h e n p r o c e s s o r p selects

    (

    2 A )+ r a s i t s n e w n a m e .

    T h e f o l l o w i n g t w o l e m m a s p r o v e t h a t t h e a l g o r i t h m i s c o r r e c t a n d t h a t a l l

    n o n f a u l t y p r o c e s s o r s s e l e c t a n e w n a m e . N a m e l y , e a c h n o n f a u l t y p r o c e s s o r s e l e c t s

    a d i s t i n c t n e w n a m e a f t e r a f i n i t e n u m b e r o f o p e r a t i o n s .

    L e m m a 6 . 1 ( C o r r e c t n e s s ) . I n a n y r u n o f A l g o r i t h m RENAMING, i f p and qs e l e c t t h e n e w n a m e s x p and x q , r e s p e c t i v e l y , t h e n x , : 0 y q .

    Proof L e t

    sXP = + r pa n d l e t

    s

    x q = + r q .

    I f s p = s q , t h e n , b y C o r o l l a r y 6 . 2 , p a n d q a r e d e c i d e d a c c o r d i n g t o t h e s a m e

    s e t o f o l d n a m e s . T h e r e f o r e , t h e i r r a n k s , r p and r q , a r e n o t e q u a l a n d c o n s e q u e n t l y

    Xp 0 x q . I f s p # s q , t h e n a s s u m e w i t h o u t l o s s o f g e n e r a l i t y t h a t

    s p < s q . As r p < S Pi t f o l l o w s t h a t

    2)+rp

  • 8/3/2019 Partial Equivalence

    18/19

    3 8 A. Bar-Noy and D . D o l e vTheorem 6 . 1 . A l g o r i t h m RENAMING s o l v e s t h e r e n a m i n g p r o b l e m w i t h a newI D s p a c e o f s i z e I n

    2

    1 )

    . T h i s s o l u t i o n i s v a l i d i n b o t h t h e s h a r e d - m e m o r y model and

    t h e m es s a g e - pa s s i n g m od e l d e fi n e d i n S e c t i o n 2 .

    I n t h e m e s s a g e - p a s s i n g m o d e l t h e s i z e o f t h e n e w s p a c e i s o f o r d e r O ( n t )[ABD+ ] . The second algorithm of [ABD + ] s o l v e s t h e r e n a m i n g p r o b l e m w i t ha n e w n a me - sp a c e of s i z e 2 n - 1 ( n + t i n t h e m e s s a g e - p a s s i n g m o d e l ) . S i n c e i t i sa l s o b a s e d o n t h e s c h e m a t i c a l g o r i t h m , T h e o r e m 6 . 1 c a n b e i m p r o v e d a c c o r d i n g l y .

    A r e l a t e d p r o b l e m t o t h e r e n a m i n g p r o b l e m r e q u i r e s t h e f o l l o w i n g : i f t h e o l d

    n a m e o f p r o c e s s o r p i s s m a l l e r t h a n t h a t o f p r o c e s s o r q , t h e n t h e n e w n a m e o f p

    i s s m a l l e r t h a n t h e n e w ID o f q . I n t h e p a p e r [ABD + ] t h i s p r o b l e m i s a l s os o l v e d . A g a i n t h e i r s o l u t i o n i s b a s e d o n t h e s c h e m a t i c a l g o r i t h m a n d , t h e r e f o r e ,

    i s v a l i d i n b o t h t h e s h a r e d - m e mo r y m o d e l a n d t h e m e s s a g e - p a s s i n g m o d e l d e f i n e d

    i n S e c t i o n 2 .

    Acknowledgment

    W e w o u l d l i k e t o t h a n k t h e a n o n y m o u s r e f e r e e s w h o s e c o m m e n t s h e l p e d u s t o i m p r o v e t h e p r e s e n t a t i o n

    o f t h i s p a p e r s u bs t a n t i a l l y .

    R e f e r e n c e s

    [A ] K. Abrahamson, On Achieving Consens us Using a Shared Memory, Proc . 7th ACMS y m p . o n P r i n c i p l e s of D i s t r i b u t e d C o m p u t i n g , p p . 2 9 1 - 3 0 2 , 1 9 8 8 .

    [ A H ] J. A spnes and M . Herlihy, Fast Randomized Consensus Using Shared Memory, J o u r n a l

    o f A l g o r i t h m s , 1 1 , 4 4 1 - 4 6 1 , 1 9 9 0 .

    [ADB+] H. A t t i y a , A . B a r - N o y , D . D ol e v , D . P e l e g , a n d R . R e i s c h u k , R e n a m i n g i n a n A s y n c h r o n o u sEnvironment, J o u r n a l o f the ACM, 37, 5 2 4 - 5 4 8 , 1 9 9 0 .

    [ADS] H. A t t i y a , D . D o l e v , a n d N . S h a v i t . Bounded Polynomial Randomized Consensus, Proc .8th ACM Sym p . o n P r i n c i p l e s o f D i s t r i b u t e d C o m p u t i n g , p p . 281-293,1989 .

    [ B ] M. Ben-Or, Another Advantage of Free Choice : Completely Asynchronous AgreementP r o t o c o l s , Proc. 2 n d A C M S y m p . o n P r i n c i p l e s of D i s t r i b u t e d C o m p u t i n g , p p . 2 7 - 3 0 ,

    1 9 8 3 .

    [ BM Z] O . B i r a n , S . Moran, and S . Z a k s , A C o m bi n a t o r i a l C h a r a c t e r i z a t i o n o f t h e D i s t r i b u t e dT a s k s W h i c h a r e S o l v a b l e i n t h e P r e s e n c e o f O n e F a u l t y P r o c e s s o r , Proc. 7th ACM Symp .

    o n P r i n c i p l e s of D i s t r i b u t e d C o m p u t i n g , p p . 2 6 3 - 2 7 5 , 1 9 8 8 .

    [ B W ] M. F. B r i d g l a n d a n d R . J . W a t r o , F a u l t - T o l e r a n t D e c i s i o n M a k i n g i n t o t a l l y A s y n c h r o n o u sD i s t r i b u t e d S y s t e m s , Proc. 6th A CM S y m p . o n P r i n c i p l e s of D i s t r i b u te d C o m p u t i n g ,

    p p . 5 2 - 6 3 , 1 9 8 7 .

    [CIL] B . C h o r , A . I s r a e l i , a n d M . L i , O n P r o c e s s o r C o o r d i n a t i o n U s i n g A s y n c h r o n o u s H a r d w a r e ,Proc. 6th ACM Symp on Principle s of D i s t r i b u t e d C o m p u t i n g , p p . 86-97,1987 .

    [ C M S ] B . Chor, M . M e r r i t t , a n d D . Shmoys, Simple Constant-Time Consen sus Protocols in

    R e a li s t ic F ai l ur e M o de l s , J o u r n a l o f the ACM, 36, 5 9 1 - 6 1 4 , 1 9 8 9 .[CM] B . Chor and L. M o s c o v i c i , S o l v a b i l i t y i n A s y n c h r o n o u s E n v i r o n m e n t s , Proc. 3 0 t h S y m p .o n F o u n d a t i o n s of C o m p u t e r S c i e n c e , p p . 4 2 2 - 4 2 7 , 1 9 8 9 .

    [ D D S ] D. Dolev, C. Dwork, and L . Stockmeyer, On the Minimal Synchronism Needed fo rD i s t r i b u t e d C o n s e n s u s , J o u r n a l of the ACM, 34 , 7 7 - 9 7 , 1 9 8 7 .

  • 8/3/2019 Partial Equivalence

    19/19

    Partial Equivalence Between Shared-Memory and Message-Passing 3 9

    [DS] D. Dolev and N . Shavit, Bounded Concurre nt Time-Stamp Systems are Construct-i b l e , Proc. 21st ACM SIGACT Symp . o n T h e o ry o f C o m pu t i n g , 1 9 89 .

    [DLS] C. Dwork, N. L y n c h , a n d L . S t o c k m e y e r , C o n s e n s us i n t h e P r e s e n c e o f P a r t i a l S y n c h r o n y ,J o u r n a l o f t h e A C M , 3 5 , 2 8 8 - 3 2 3 , 1 9 8 8 .

    [DSS] C. Dwork, D . Shmoys, and L . S t o c k m e y e r , F l i p p i n g P e r s u a s i v e l y i n C o n s t a n t E x p e c t e dT i m e , Proc. 2 7 t h S y m p . o n F ou n d a ti o n s o f C o m p u te r S c i e n c e , p p . 2 2 2 - 2 3 2 , 1 9 8 6 .

    [ F e ] P. F e l d m a n , P r i v a t e c o m m u n i c a t i o n .[ F i ] M J . F i s c h e r , T h e C o n s e n s u s P r o b l e m i n U n r e l i a b l e D i s t r i b u t e d S y s t e m s ( a B r i e f S u r v e y ) ,

    YALEU/DCS/R R-27 3, June 1983 .

    [FLP] M J . F i s c h e r , N . A . Lynch, and M. S . P a t e r s o n , I m p o s s i b i l i t y o f D i s t r i b u t ed C o n s e n s u sw i t h O n e F a u l t y P r o c e s s o r , J o u r n a l o f t h e A C M , 32 , 3 7 4 - 3 8 2 , 1 9 8 5 .

    [ G H S ] R. G . G a l l a g he r , P . A. H u m b l e t , a n d P . M. S p i r a , A D i s t r i b u t e d A l g o r i t h m f o r M i n i m u m -Weight Spanning Trees, ACM Transactions on Programming Languages and Systems, 5,

    66-77 ,1983 .

    [H ] M. P . H e r l i h y , I m p o s s i b i l i t y a n d U n i v e r s a l i t y R e s u l t s f o r W a i t - F r e e S y n c h r o n i z a t i o n ,Proc. 7th ACM Symp . o n P r i n c i p l e s o f D i s t r i b u t e d C o m p u t i n g , p p . 2 7 6 - 2 9 0 , 1 9 8 8 .

    [ I L ] A. I s r a e l i a n d M . L i , B o u n d e d T i m e - S t a m p s , Proc . 2 8 t h S y m p . o n F o u n d a t i o n s o f C o m p u te rS c i e n c e , p p . 3 7 1 - 3 8 2 , 1 9 8 7 .

    [ L ] L. Lamport, On Interproce ss Com muni cation, Part I and II, D i s t r i b u te d C o m p u t i n g ,1 , 7 7 - 1 0 1 , 1 9 8 6 .

    [LA] M. G . L o u i a n d H . Abu-Amara, Memory Requ irements for Agreeme nt Among UnreliableA s y n c h ro n o u s P r oc e s s e s , A d v a n c es i n C o m p ut i n g R e s e a r c h, 4 , 1 6 3 - 1 8 3 , 1 9 8 7 .

    [PSL] M. P e a s e , R . S h o s t a k , a n d L . L a m p o r t , R e a c h i n g A g r e e m e n t i n t h e P r e s e n c e o f Fa u l t s ,J o u r n a l o f t h e A C M, 2 7 , 2 2 8 - 2 3 4 , 1 9 8 0 .

    R e c e i ve d J a n ua r y 1 0 , 1 9 9 0, a n d i n r e v is e d fo r m O c t ob e r 1 0 , 1 9 9 0, and November 11, 1990, and

    i n f i n a l f o r m D e c e m b e r 2 0 , 1991 .