I n s o l i d a r i t y w i t h t h e p e o p - - PowerPoint PPT Presentation

i n s o l i d a r i t y w i t h t h e p e o p l e o f f e
SMART_READER_LITE
LIVE PREVIEW

I n s o l i d a r i t y w i t h t h e p e o p - - PowerPoint PPT Presentation

I n s o l i d a r i t y w i t h t h e p e o p l e o f F e r g u s o n a n d t h e i r p r o t e s t s a g a i n s t p o l i c e v i o l e n c e H o w t o M a k e E r


slide-1
SLIDE 1

I n s

  • l

i d a r i t y w i t h t h e p e

  • p

l e

  • f

F e r g u s

  • n

a n d t h e i r p r

  • t

e s t s a g a i n s t p

  • l

i c e v i

  • l

e n c e

slide-2
SLIDE 2

H

  • w

t

  • M

a k e E r r

  • r

H a n d l i n g L e s s E r r

  • r
  • P

r

  • n

e

“ B a c k t

  • t

h e F u t u r e ™ ” i s a t r a d e ma r k

  • f

U n i v e r s a l C i t y S t u d i

  • s

, I n c . a n d A mb l i n E n t e r t a i n me n t , I n c . I a m c l a i mi n g f a i r u s e

  • f

t h i s t r a d e ma r k a n d l

  • g
  • .

I ma g e f r

  • m

f u s i

  • n
  • i

n d u s t r i e s 1 . t r i p

  • d

. c

  • m.

Rescuing error handling ideas from the 1970s!

  • r

. . .

slide-3
SLIDE 3

H

  • w

t

  • M

a k e E r r

  • r

H a n d l i n g L e s s E r r

  • r
  • P

r

  • n

e

I n t r

  • d

u c t i

  • n

S e q u e n t i a l e r r

  • r

h a n d l i n g E r r

  • r

s t a t u s , r e t u r n c

  • d

e s , e r r

  • r

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

  • n

s R e c

  • v

e r y b l

  • c

k s R

  • l

l b a c k e r r

  • r

r e c

  • v

e r y M

  • t

i v a t i

  • n

O p t i mi s a t i

  • n

s S y n e r g y w i t h

  • t

h e r f e a t u r e s C

  • n

c u r r e n t e r r

  • r

h a n d l i n g O u t p u t v a l i d i t y T h e K e n p r

  • t
  • c
  • l

P r

  • mi

s e s

slide-4
SLIDE 4

I n t r

  • d

u c t i

  • n

“ E r r

  • r

” c

  • me

s f r

  • m

a L a t i n v e r b me a n i n g “ t

  • s

t r a y ” . F

  • r
  • u

r p u r p

  • s

e s , e r r

  • r

s a r e c a s e s w h e r e t h e e x e c u t i

  • n
  • f

a p r

  • g

r a m s t r a y s f r

  • m

i t s u s u a l p a t h . We ’ l l b e c

  • n

s i d e r i n g e r r

  • r

s i n r e l a t i

  • n

t

  • h

i g h

  • l

e v e l l a n g u a g e p r

  • g

r a mmi n g a n d d i s t r i b u t e d s y s t e ms . E r r

  • r

s a t

  • t

h e r l a y e r s –

  • p

e r a t i n g s y s t e ms , h a r d w a r e , e t c . – a r e i mp

  • r

t a n t b u t n

  • t

w h a t t h i s t a l k i s f

  • c

u s s e d

  • n

. T h i s i n c l u d e s : c a s e s t h a t t h e l a n g u a g e

  • r

p r

  • g

r a m d e f i n e s t

  • b

e e r r

  • r

s ; c a s e s w h e r e t h e l a n g u a g e i mp l e me n t a t i

  • n
  • r

p r

  • g

r a m i s u n a b l e t

  • me

e t i t s s p e c i f i c a t i

  • n

. E r r

  • r

h a n d l i n g i s t h e r e s p

  • n

s e t

  • e

r r

  • r

s . A n e r r

  • r

h a n d l i n g m e c h a n i s m i s a f e a t u r e

  • f

a l a n g u a g e d e s i g n e d t

  • e

n a b l e r e s p

  • n

d i n g t

  • e

r r

  • r

s . A n e r r

  • r

h a n d l i n g p a t t e r n i s a p a t t e r n

  • f

u s e

  • f

a l a n g u a g e t

  • r

e s p

  • n

d (

  • r

n

  • t

! ) t

  • e

r r

  • r

s . T h i s t a l k i s a b

  • u

t e n g i n e e r i n g

  • f

e r r

  • r

h a n d l i n g me c h a n i s ms a n d p a t t e r n s f

  • r

d e p e n d a b i l i t y . D e p e n d a b i l i t y me a n s c

  • n

s i s t e n t l y d

  • i

n g s

  • me

t h i n g r e a s

  • n

a b l e , t h a t

  • t

h e r c

  • d

e

  • r

a u s e r c

  • u

l d d e p e n d

  • n

, i n t h e f a c e

  • f

p

  • t

e n t i a l e r r

  • r

s . L e t ’ s c

  • n

s i d e r s

  • me

c

  • mmo

n e r r

  • r

h a n d l i n g me c h a n i s ms a n d p a t t e r n s , a n d w h a t c a n g

  • w

r

  • n

g w i t h t h e m.

slide-5
SLIDE 5

E r r

  • r

s t a t e

H

  • l

d t h e “ l a s t e r r

  • r

” i n a p e r

  • p

r

  • c

e s s

  • r

p e r

  • t

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

  • n

, ma y b e d i r e c t l y . U s e d i n : C / U n i x ( e r r n

  • )

; Wi n d

  • w

s A P I ( G e t L a s t E r r

  • r

) ; P e r l ( y

  • u

d

  • n

’ t w a n t t

  • k

n

  • w

) ; P H P ( e r r

  • r

_ g e t _ l a s t ) ; v a r i

  • u

s s h e l l l a n g u a g e s P r

  • b

l e ms : P r

  • g

r a mme r s ma y mi s u n d e r s t a n d t h e d e f i n e d c

  • n

v e n t i

  • n

s f

  • r

u s e

  • f

t h e s t a t e v a r i a b l e , w h i c h a r e

  • f

t e n s u b t l e

  • r

b a d l y d

  • c

u me n t e d .

F

  • r

e x a mp l e , P O S I X s a y s : “ T h e s e t t i n g

  • f

e r r n

  • a

f t e r a s u c c e s s f u l c a l l t

  • a

f u n c t i

  • n

i s u n s p e c i f i e d u n l e s s t h e d e s c r i p t i

  • n
  • f

t h a t f u n c t i

  • n

s p e c i f i e s t h a t e r r n

  • s

h a l l n

  • t

b e mo d i f i e d . ” S

  • t

h e c

  • mmo

n l y u s e d p a t t e r n ( r e c

  • mme

n d e d i n f

  • t

n

  • t

e 2 2

  • f

t h e C 9 9 a n d C 1 1 s t a n d a r d s )

  • f

s e t t i n g e r r n

  • t
  • z

e r

  • b

e f

  • r

e a f u n c t i

  • n

c a l l a n d t h e n c h e c k i n g t h a t i t i s n

  • n
  • z

e r

  • a

f t e r w a r d i s i n c

  • r

r e c t ; i n a l mo s t a l l c a s e s i t ’ s n e c e s s a r y t

  • c

h e c k t h e r e t u r n v a l u e a f t e r e a c h c a l l i n s t e a d . Wi n d

  • w

s ’ G e t L a s t E r r

  • r

i s e v e n l e s s c

  • n

s i s t e n t t h a n t h i s .

T h e p a t h

  • f

l e a s t r e s i s t a n c e i s t

  • mi

t c h e c k i n g f

  • r

a n e r r

  • r

. T h i s i s v e r y c

  • mmo

n i n C a n d Wi n d

  • w

s p r

  • g

r a ms . I n “ c l e a n u p ” c

  • d

e b e f

  • r

e a n e r r

  • r

i s p r

  • p

a g a t e d t

  • t

h e c a l l e r , a n

  • t

h e r

  • p

e r a t i

  • n

mi g h t c l

  • b

b e r t h e e r r

  • r

s t a t e . L a n g u a g e s t h a t r e q u i r e l e s s e x p l i c i t c l e a n u p a r e i n a b e t t e r p

  • s

i t i

  • n

h e r e . B e c a u s e e r r

  • r

c h e c k i n g i s p r

  • g

r a mme d e x p l i c i t l y , i t ' s e a s y t

  • g

e t i t w r

  • n

g .

slide-6
SLIDE 6

R e t u r n c

  • d

e s

R e t u r n a n e r r

  • r

c

  • d

e ,

  • r

a v a l u e i n d i c a t i n g s u c c e s s , f r

  • m

e a c h f u n c t i

  • n

t h a t mi g h t f a i l . U s e d i n : C ; mo s t

  • p

e r a t i n g s y s t e m A P I s ; mo s t l i b r a r y A P I s i n l a n g u a g e s w i t h

  • u

t e x c e p t i

  • n

s . P r

  • b

l e ms : I f t h e l a n g u a g e d

  • e

s n ’ t d i r e c t l y s u p p

  • r

t mu l t i p l e r e t u r n v a l u e s , y

  • u

mi g h t b e u n a b l e t

  • a

l s

  • r

e t u r n s

  • me

mo r e n a t u r a l r e s u l t ,

  • r

h a v e t

  • u

s e a n u g l i e r A P I . C

  • n

v e n t i

  • n

s f

  • r

w h a t r e t u r n c

  • d

e s me a n ( w h i c h c

  • d

e i s u s e d f

  • r

s u c c e s s a n d w h i c h c

  • d

e s f

  • r

p a r t i c u l a r e r r

  • r

s ) c a n b e i n c

  • n

s i s t e n t , e s p e c i a l l y a c r

  • s

s l i b r a r i e s a n d c

  • d

e w r i t t e n b y d i f f e r e n t p e

  • p

l e

  • r

t e a ms . R e f a c t

  • r

i n g i s h a z a r d

  • u

s : i f t h e me a n i n g

  • f

a r e t u r n c

  • d

e c h a n g e s t h e n a l l c a l l e r s mu s t c h a n g e . T h e p a t h

  • f

l e a s t r e s i s t a n c e i s t

  • mi

t c h e c k i n g f

  • r

a n e r r

  • r

. I f c l e a n u p i s n e e d e d , i t i s e a s y t

  • f

a i l t

  • p

r

  • p

a g a t e t h e e r r

  • r

c

  • r

r e c t l y .

T h e c a u s e

  • f

t h e G n u T L S c e r t i f i c a t e c h e c k i n g b u g w a s a c

  • mb

i n a t i

  • n
  • f

s e v e r a l

  • f

t h e s e p r

  • b

l e ms . T h e r e w a s a f u n c t i

  • n

c a l l e d

check_if_ca

t h a t w a s d e f i n e d t

  • r

e t u r n n

  • n
  • z

e r

  • i

f g i v e n a C A c e r t i f i c a t e , b u t t h i s c

  • n

f l i c t e d w i t h t h e u s u a l c

  • n

v e n t i

  • n

i n G n u T L S

  • f

r e t u r n i n g a n e g a t i v e i n t e g e r f

  • r

a n e r r

  • r

. T h e b u g w a s i n t r

  • d

u c e d b y a r e f a c t

  • r

i n g t h a t c h a n g e d ma n y f u n c t i

  • n

s , mo s t

  • f

w h i c h u s e d t h e u s u a l r e t u r n c

  • n

v e n t i

  • n

. C l e a n u p h a n d l i n g w a s a l s

  • a

f a c t

  • r

b e c a u s e i t r e s u l t e d i n t h e r e t u r n b e i n g f u r t h e r f r

  • m

t h e c

  • d

e t h a t c h e c k e d f

  • r

e r r

  • r

s . I n t h e A p p l e O p e n S S L “ g

  • t
  • f

a i l ; ” b u g , t h e c l e a n u p c

  • d

e w a s w r i t t e n i n c

  • r

r e c t l y , r e s u l t i n g i n p a r t

  • f

t h e n e c e s s a r y c

  • d

e f

  • r

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

slide-7
SLIDE 7

E r r

  • r

v a l u e s

A d d a n e x t r a v a l u e

  • f

a t y p e t

  • i

n d i c a t e a n e r r

  • r

. O p e r a t i

  • n

s t h a t a r e g i v e n a n e r r

  • r

v a l u e f

  • r

a n y

  • f

t h e i r i n p u t s , u s u a l l y p r

  • p

a g a t e i t t

  • t

h e i r

  • u

t p u t . E x a mp l e s :

I E E E 7 5 4 N a N v a l u e s S Q L N U L L , s

  • r

t

  • f

( i t s s e ma n t i c s a r e mo r e s u i t e d t

  • r

e p r e s e n t i n g mi s s i n g i n f

  • r

ma t i

  • n

) a s a n

  • b

j e c t

  • r

i e n t e d p r

  • g

r a mmi n g p a t t e r n ( n

  • t

t

  • b

e c

  • n

f u s e d w i t h t h e N u l l O b j e c t p a t t e r n )

P r

  • b

l e ms :

I f

  • n

l y s

  • me

t y p e s h a v e e r r

  • r

v a l u e s , w e g e t u n i n t u i t i v e b e h a v i

  • u

r ( e . g . d u e t

  • h

a v i n g a n e r r

  • r

v a l u e f

  • r

double

b u t n

  • t

f

  • r

boolean)

. I f a l l t y p e s h a v e e r r

  • r

v a l u e s ( a s i n S Q L ) , w e n e e d a t h r e e

  • v

a l u e d l

  • g

i c w h i c h i s u n f a mi l i a r . T h e r e i s a t e mp t a t i

  • n

t

  • c
  • n

f l a t e “ mi s s i n g ”

  • r

“ n

  • t

a p p l i c a b l e ” v a l u e s w i t h e r r

  • r

v a l u e s , e v e n i f t h e i r s e ma n t i c s s h

  • u

l d b e d i f f e r e n t . O n t h e

  • t

h e r h a n d , a d d i t i

  • n

a l c

  • mp

l e x i t y c a n a r i s e f r

  • m

h a v i n g mu l t i p l e k i n d s

  • f

e r r

  • r

v a l u e ( f

  • r

e x a mp l e “ q u i e t ” a n d “ s i g n a l l i n g ” N a N s i n I E E E 7 5 4 ) . O p e r a t i

  • n

s t h a t t a k e a n e r r

  • r

v a l u e a s i n p u t ma y n

  • t

p r

  • d

u c e

  • n

e a s

  • u

t p u t ( e . g . t h e 2 8 I E E E 7 5 4 s t a n d a r d s a y s t h a t

pow(1, quietNaN) a

n d

pow(quietNaN, 0)

s h

  • u

l d r e t u r n 1 ) . E r r

  • r

v a l u e s c a n e n d u p b e i n g s t

  • r

e d i n u n a n t i c i p a t e d p l a c e s , d e l a y i n g t h e d e t e c t i

  • n
  • f

a n e r r

  • r

t

  • a

r b i t r a r i l y l

  • n

g a n d f a r a w a y f r

  • m

i t s i n t r

  • d

u c t i

  • n

. ( A l t h

  • u

g h w e c

  • u

l d i n p r i n c i p l e r e c

  • r

d d e b u g i n f

  • r

ma t i

  • n

a b

  • u

t w h e r e t h e e r r

  • r

v a l u e w a s f i r s t i n t r

  • d

u c e d , t y p i c a l l y t h a t i s n ’ t d

  • n

e . ) I t i s e a s y t

  • mi

t c h e c k i n g f

  • r

a n e r r

  • r

( u n l e s s “ s i g n a l l i n g ” e r r

  • r

v a l u e s a r e u s e d , b u t t h

  • s

e r e q u i r e a n a d d i t i

  • n

a l e r r

  • r

h a n d l i n g me c h a n i s m f

  • r

t h e s i g n a l l i n g ) .

slide-8
SLIDE 8

F u n w i t h N a N s

Wh a t d

  • e

s t h i s J a v a p r

  • g

r a m p r i n t ?

public class P { static <T> boolean equals_itself(T x) { return x == x; } static <T> boolean equals(T x, T y) { return x == y; } public static void main(String[] args) { double d = Double.NaN; System.out.println("d == d: " + (d == d)); System.out.println("equals_itself(d): " + equals_itself(d)); System.out.println("equals(d, d): " + equals(d, d)); } }

slide-9
SLIDE 9

F u n w i t h N a N s

Wh a t d

  • e

s t h i s J a v a p r

  • g

r a m p r i n t ?

public class P { static <T> boolean equals_itself(T x) { return x == x; } static <T> boolean equals(T x, T y) { return x == y; } public static void main(String[] args) { double d = Double.NaN; System.out.println("d == d: " + (d == d)); System.out.println("equals_itself(d): " + equals_itself(d)); System.out.println("equals(d, d): " + equals(d, d)); } } java P d == d: false equals_itself(d): true equals(d, d): false ( I n

main,

==”

i s v a l u e e q u a l i t y

  • n

doubles

, w h i c h i s

false

f

  • r

NaN == NaN.

I n

equals_itself and equals,

==”

i s r e f e r e n c e e q u a l i t y

  • n

b

  • x

e d

Double

  • b

j e c t s . S

  • equals_itself

w i l l a l w a y s r e t u r n

true,

w h i l e e q u a l s ( x , x ) w i l l r e t u r n

false

f

  • r

p r i mi t i v e t y p e s , s i n c e b

  • x

i n g i s r e p e a t e d f

  • r

e a c h a r g u me n t . )

slide-10
SLIDE 10

H a n d l e r s w i t h p e r

  • p

r

  • c

e s s / t h r e a d e x t e n t

A p e r

  • p

r

  • c

e s s

  • r

p e r

  • t

h r e a d v a r i a b l e p

  • i

n t s t

  • a

h a n d l e r f

  • r

a g i v e n s u b s e t

  • f

e r r

  • r

s . U s e d i n : U n i x ( f

  • r

e x a mp l e s i g f p e a n d

  • t

h e r s i g n a l s ) ; P L / I ; s

  • me

B A S I C s P r

  • b

l e ms : T h e r e i s a mi s ma t c h b e t w e e n t h e c

  • n

t e x t a v a i l a b l e t

  • t

h e h a n d l e r ( e . g . l e x i c a l c

  • n

t e x t i f t h e l a n g u a g e h a s c l

  • s

u r e s ) , a n d t h e e x t e n t i n w h i c h i t i s e n a b l e d . T h e h a n d l e r u s u a l l y h a s l i t t l e i f a n y i n f

  • r

ma t i

  • n

a b

  • u

t w h i c h c a l l f a i l e d . A h a n d l e r ma y a c c i d e n t a l l y b e l e f t e n a b l e d f

  • r

l

  • n

g e r t h a n i t s h

  • u

l d b e ,

  • r

t h e p r e v i

  • u

s h a n d l e r ma y n

  • t

b e r e s t

  • r

e d . H a n d l e r s c a n ' t b e e a s i l y c

  • mb

i n e d ;

  • n

l y

  • n

e i s v a l i d a t a t i me f

  • r

a g i v e n e r r

  • r

c a t e g

  • r

y . S i n c e t h e h a n d l e r c a n b e c a l l e d a t e s s e n t i a l l y a n y t i me , i t i s v e r y r e s t r i c t e d i n w h a t i t c a n s a f e l y d

  • .

I t ' s n

  • t

p

  • s

s i b l e t

  • c
  • n

s t r u c t a d e p e n d a b l e e r r

  • r

h a n d l i n g me c h a n i s m b y i n v

  • k

i n g a h a n d l e r a f t e r t h e r e h a s a l r e a d y b e e n u n d e f i n e d b e h a v i

  • u

r , a s i s t h e c a s e f

  • r

s

  • me

U n i x s i g n a l s .

slide-11
SLIDE 11

H a n d l e r s a s s

  • c

i a t e d w i t h

  • b

j e c t s

  • r

c

  • n

t e x t s

S e t a h a n d l e r

  • n

a n

  • b

j e c t t h a t i s c a l l e d i f a n

  • p

e r a t i

  • n
  • n

t h a t

  • b

j e c t f a i l s . U s e d i n : g t k , O p e n S S L P r

  • b

l e ms : I t c a n b e t r i c k y t

  • e

n s u r e t h a t h a n d l e r s a r e e n a b l e d

  • n

a l l r e l e v a n t

  • b

j e c t s / c

  • n

t e x t s . I t ' s n

  • t

c l e a r t h a t h a n d l i n g u s u a l l y d e p e n d s

  • n

t h e

  • b

j e c t ( a s

  • p

p

  • s

e d t

  • t

h e c a l l i n g c

  • n

t e x t ) . H a n d l e r s c a n ' t b e e a s i l y c

  • mb

i n e d . S

  • me
  • t

h e r e r r

  • r

h a n d l i n g me c h a n i s m i s a l s

  • n

e e d e d i f w e w a n t t

  • a

f f e c t t h e c

  • n

t r

  • l

f l

  • w
  • f

t h e c a l l i n g c

  • n

t e x t .

slide-12
SLIDE 12

E x c e p t i

  • n

s

P r

  • p
  • s

e d b y J

  • h

n B . G

  • d

e n

  • u

g h i n 1 9 7 4 / 5 . T h e r e w e r e

  • t

h e r p r

  • p
  • s

a l s w i t h s i mi l a r p r

  • p

e r t i e s a t a b

  • u

t t h e s a me t i me

  • r

s l i g h t l y e a r l i e r , f

  • r

e x a mp l e t h e s i g n a l l i n g me c h a n i s m i n s e c t i

  • n

8 . 1

  • f

[ L M S 1 9 7 4 ] . G

  • d

e n

  • u

g h ’ s 1 9 7 5 p a p e r i s a c l a s s i c , v e r y t h

  • r
  • u

g h a n d w e l l

  • w

r i t t e n , a n d i t me n t i

  • n

s a l l

  • f

t h e me c h a n i s ms i n t h e p r e v i

  • u

s s l i d e s . H i g h l y r e c

  • mme

n d e d ! I ' m g

  • i

n g t

  • a

s s u me k n

  • w

l e d g e

  • f

h

  • w

e x c e p t i

  • n

s w

  • r

k i n r e c e n t l a n g u a g e s . G

  • d

e n

  • u

g h ’ s

  • r

i g i n a l p r

  • p
  • s

a l d i f f e r e d i n t h e f

  • l

l

  • w

i n g w a y s : T y p i c a l l y , e x c e p t i

  • n

s a r e n

  • w
  • n

l y d e s i g n e d t

  • b

e u s e d t

  • s

i g n a l e r r

  • r

s . G

  • d

e n

  • u

g h d i s c u s s e d u s i n g t h e m a s a g e n e r a l f l

  • w

c

  • n

t r

  • l

me c h a n i s m, a n d p

  • s

s i b l y b e i n g r a i s e d f r

  • m

e v e r y c a l l t

  • a

r

  • u

t i n e . H e a l s

  • d

i s c u s s e d a p p l i c a t i

  • n

s s u c h a s p r

  • g

r e s s mo n i t

  • r

i n g t h a t w

  • u

l d b e a p

  • r

f i t t

  • e

x c e p t i

  • n

s a s i mp l e me n t e d i n mo s t c u r r e n t l a n g u a g e s . C

  • mmo

n L i s p ' s c

  • n

d i t i

  • n

/ r e s t a r t me c h a n i s m i s p r

  • b

a b l y p r

  • v

i d e s t h e n e a r e s t t h i n g t

  • t

h i s

  • r

i g i n a l p r

  • p
  • s

a l t h a t h a s b e e n i mp l e me n t e d i n a w i d e l y u s e d l a n g u a g e . I n

  • t

h e r l a n g u a g e s , a p p l i c a t i

  • n

s f

  • r

t h i s e x t r a f u n c t i

  • n

a l i t y w

  • u

l d p r

  • b

a b l y b e b e t t e r i mp l e me n t e d v i a c

  • n

t i n u a t i

  • n

s

  • r

g e n e r a t

  • r

s . E x c e p t i

  • n

s w e r e a h u g e i mp r

  • v

e me n t

  • n

p r e v i

  • u

s t e c h n i q u e s : B y d e f a u l t , i f a c a l l e r i n c l u d e s n

  • e

r r

  • r

h a n d l i n g c

  • d

e , t h e e x c e p t i

  • n

w i l l b e p r

  • p

a g a t e d t

  • i

t s c a l l e r . T h e e x c e p t i

  • n

h a n d l e r

  • n

l y r u n s i n t h e e r r

  • r

c a s e , s

  • i

t i s i mp

  • s

s i b l e f

  • r

i t t

  • me

s s u p t h e n

  • n
  • e

r r

  • r

c a s e . I n s

  • me

l a n g u a g e s , i t i s p

  • s

s i b l e t

  • s

t a t i c a l l y d e c l a r e w h i c h e x c e p t i

  • n

s a r

  • u

t i n e c a n r a i s e .

slide-13
SLIDE 13

E x c e p t i

  • n

s

E x c e p t i

  • n

s a r e “ g

  • d

e n

  • u

g h ” ( g r

  • a

n ) f

  • r

mo s t p u r p

  • s

e s . U s e t h e m i n p r e f e r e n c e t

  • t

h e me c h a n i s ms d e s c r i b e d e a r l i e r ! R e ma i n i n g p r

  • b

l e ms : D e s i g n i n g a g

  • d

h i e r a r c h y

  • f

e x c e p t i

  • n

c l a s s e s c a n b e d i f f i c u l t . E x c e p t i

  • n

s d

  • n

' t s

  • l

v e t h e p r

  • b

l e m

  • f

ma i n t a i n i n g a c

  • n

s i s t e n t s t a t e .

E x c e p t i

  • n

s + M u t a b l e s t a t e ⇓ A b s t r a c t i

  • n

l e a k s

slide-14
SLIDE 14

E x c e p t i

  • n

“ s a f e t y ”

T h e f

  • l

l

  • w

i n g s y s t e m

  • f

e x c e p t i

  • n

c

  • n

t r a c t s w a s p r

  • p
  • s

e d b y D a v i d A b r a h a ms i n t h e c

  • n

t e x t

  • f

s t a n d a r d i z i n g t h e C + + s t a n d a r d l i b r a r y . T h e s y s t e m c l a s s i f i e s

  • p

e r a t i

  • n

s a c c

  • r

d i n g t

  • t

h e g u a r a n t e e s t h e y ma k e a b

  • u

t e x c e p t i

  • n

s a n d s t a t e : T h e b a s i c g u a r a n t e e : t h a t t h e i n v a r i a n t s

  • f

t h e c

  • mp
  • n

e n t a r e p r e s e r v e d , a n d n

  • r

e s

  • u

r c e s a r e l e a k e d . T h e s t r

  • n

g g u a r a n t e e : t h a t t h e

  • p

e r a t i

  • n

h a s e i t h e r c

  • mp

l e t e d s u c c e s s f u l l y

  • r

t h r

  • w

n a n e x c e p t i

  • n

, l e a v i n g t h e p r

  • g

r a m s t a t e e x a c t l y a s i t w a s b e f

  • r

e t h e

  • p

e r a t i

  • n

s t a r t e d . T h e n

  • t

h r

  • w

g u a r a n t e e : t h a t t h e

  • p

e r a t i

  • n

w i l l n

  • t

t h r

  • w

a n e x c e p t i

  • n

. T h i s i s e s s e n t i a l l y a s t a t i c e f f e c t s y s t e m.

slide-15
SLIDE 15

E x c e p t i

  • n

“ s a f e t y ”

U n f

  • r

t u n a t e l y , t h i s s y s t e m d

  • e

s n

  • t

c

  • mp
  • s

e w e l l i n g e n e r a l . T h e { n

  • t

h r

  • w

, s t r

  • n

g } s u b s e t c

  • mp
  • s

e s w e l l : n

  • t

h r

  • w

→ n

  • t

h r

  • w

( ) s t r

  • n

g → n

  • t

h r

  • w

( ) s t r

  • n

g → s t r

  • n

g ( ) n

  • t

h r

  • w

→ t r y { s t r

  • n

g ( ) } c a t c h a l l { n

  • t

h r

  • w

( ) } A d d i n g a d e e p f r

  • z

e n c l a s s i f i e r f

  • r

t h i n g s t h a t r e f e r e n c e n

  • p

r e e x i s t i n g s t a t e , a l s

  • c
  • mp
  • s

e s w e l l : s t r

  • n

g → d e e p f r

  • z

e n ( ) s t r

  • n

g { → f , m = d e e p f r

  • z

e n ( ) ; t r y { f ( m) } c a t c h a l l { s t r

  • n

g ( ) } } ( T h e n a me a n d d e f i n i t i

  • n
  • f

d e e p f r

  • z

e n c

  • me

s f r

  • m

t h e a u d i t i n g s y s t e m

  • f

E . ) B u t i f w e h a v e a b a s i c

  • p

e r a t i

  • n

, i t ' s d i f f i c u l t t

  • a

s t r

  • n

g

  • r

n

  • t

h r

  • w
  • p

e r a t i

  • n

f r

  • m

i t . A b r a h a ms ’ p a p e r s u g g e s t s c

  • p

y i n g , s

  • me

t h i n g l i k e t h i s : s t r

  • n

g { → f = d e e p f r

  • z

e n ( ) ; t r y { m 2 = c

  • p

y ( m1 ) ; f ( m2 ) } c a t c h a l l { s t r

  • n

g ( ) } } B u t w e ma y n

  • t

w a n t t

  • c
  • p

y ! T h e g

  • a

l ma y b e t

  • mo

d i f y t h e

  • r

i g i n a l

  • b

j e c t / s t r u c t u r e . I n t h e

  • r

i g i n a l c

  • n

t e x t

  • f

t h e C + + s t a n d a r d l i b r a r y , t h i s p r

  • b

l e m i s n

  • t

s

  • v

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

  • n

l y f

  • r

“ l e a f ”

  • p

e r a t i

  • n

s . B u t f

  • r

a p p l i c a t i

  • n

p r

  • g

r a mmi n g , i t d e f e a t s t h e g e n e r a l a p p l i c a b i l i t y

  • f

t h e w h

  • l

e i d e a – u n l e s s t h e l a n g u a g e p r

  • v

i d e s s u p p

  • r

t f

  • r

e n s u r i n g t h a t mu t a t i n g

  • p

e r a t i

  • n

s c a n b e g i v e n t h e s t r

  • n

g g u a r a n t e e i n g e n e r a l .

slide-16
SLIDE 16

R e c

  • v

e r y b l

  • c

k s

I n G

  • d

e n

  • u

g h ’ s 1 9 7 5 p a p e r , i t w a s b r i e f l y s u g g e s t e d t h a t “ S

  • me

t i me s a s a s i d e

  • e

f f e c t

  • f

t e r mi n a t i n g t h e

  • p

e r a t i

  • n

, i t i s n e c e s s a r y t

  • u

n d

  • a

l l e f f e c t s

  • f

a t t e mp t i n g t h e

  • p

e r a t i

  • n

. ” H

  • w

e v e r , t h i s w a s n

  • t

t a k e n u p b y a n y

  • f

t h e ma i n s t r e a m l a n g u a g e s t h a t i mp l e me n t e d e x c e p t i

  • n

s . R e c

  • v

e r y b l

  • c

k s a r e a n

  • t

h e r me c h a n i s m i n w h i c h r

  • l

l b a c k i s a n e s s e n t i a l p a r t

  • f

t h e s e ma n t i c s . T h e y w e r e p r

  • p
  • s

e d a r

  • u

n d t h e s a me t i me a s e x c e p t i

  • n

s ( 1 9 7 4 ) , b y B r i a n R a n d e l l ’ s r e s e a r c h g r

  • u

p a t t h e U n i v e r s i t y

  • f

N e w c a s t l e u p

  • n

T y n e ( w h i c h e v

  • l

v e d i n t

  • t

h e D e p e n d a b i l i t y R e s e a r c h G r

  • u

p ; s e e [ R a n d e l l 1 9 9 7 ] f

  • r

t h e h i s t

  • r

y ) . A r e c

  • v

e r y b l

  • c

k l

  • k

s l i k e t h i s : ensure acceptance_test

by Alt1 [else by Alt2 ⁝ else by Altn] else error

F i r s t

Alt1

i s e x e c u t e d . I f i t f a i l s

  • r

i f t h e a c c e p t a n c e c

  • n

d i t i

  • n

i s n

  • t

t r u e a f t e r i t s e x e c u t i

  • n

,

Alt2

i s e x e c u t e d , a n d s

  • n

. I f n

  • n

e

  • f

t h e a l t e r n a t e s s u c c e e d i n ma k i n g t h e a c c e p t a n c e c

  • n

d i t i

  • n

t r u e , t h e n t h e

ensure

c

  • n

s t r u c t f a i l s . N

  • t

e t h a t t h e a l t e r n a t e b l

  • c

k s c a n f a i l i n d e p e n d e n t l y

  • f

t h e a c c e p t a n c e t e s t . T h i s c a n h a p p e n i f a l l a l t e r n a t i v e s

  • f

a n e s t e d b l

  • c

k f a i l ,

  • r

i f t h e r e i s s

  • me

e r r

  • r

s i g n a l l e d b y t h e l a n g u a g e

  • r

p r

  • g

r a m. T h e a c c e p t a n c e c

  • n

d i t i

  • n

c a n r e f e r t

  • v

a r i a b l e s b

  • t

h b e f

  • r

e a n d a f t e r t h e e x e c u t i

  • n
  • f

t h e a l t e r n a t e s .

slide-17
SLIDE 17

R e c

  • v

e r y b l

  • c

k s v s t r y / c a t c h

C

  • mp

a r e :

ensure true by Alt1 else by Alt2 else error

T h e d i f f e r e n c e i s t h a t i n t h e r e c

  • v

e r y b l

  • c

k , s t a t e c h a n g e d b y Alt1 w i l l b e r

  • l

l e d b a c k b e f

  • r

e e x e c u t i n g Alt2, i f Alt1 f a i l s . I f r e c

  • v

e r y b l

  • c

k s w e r e u s e d c

  • n

s i s t e n t l y i n p l a c e

  • f

e x c e p t i

  • n

s , t h e e f f e c t w

  • u

l d b e t h a t a l l c

  • d

e w

  • u

l d s a t i s f y t h e s t r

  • n

g e x c e p t i

  • n

g u a r a n t e e . ( I t i s u n

  • b

s e r v a b l e w h e t h e r t h e r

  • l

l b a c k i s d

  • n

e b y e a c h f u n c t i

  • n

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

  • p

a g a t e s a n e x c e p t i

  • n

,

  • r

b y e n s u r e c

  • n

s t r u c t s , p r

  • v

i d e d t h a t i t i s n e v e r p

  • s

s i b l e t

  • c

a t c h a n e x c e p t i

  • n

w i t h

  • u

t p e r f

  • r

mi n g r

  • l

l b a c k . ) T h e a c c e p t a n c e c

  • n

d i t i

  • n

a n d t h e a b i l i t y t

  • c

a t c h

  • n

l y a s u b s e t

  • f

e r r

  • r

s a r e i n e s s e n t i a l d i f f e r e n c e s : w e c

  • u

l d e x t e n d t r y / c a t c h w i t h a n a c c e p t a n c e c

  • n

d i t i

  • n

,

  • r

p r

  • v

i d e a w a y f

  • r

a l t e r n a t e s i n a r e c

  • v

e r y b l

  • c

k t

  • d

e p e n d

  • n

w h i c h e r r

  • r

i s r a i s e d b y a p r e v i

  • u

s a l t e r n a t e . ( R a n d e l l e t a l q u i t e d e l i b e r a t e l y a v

  • i

d e d t h e l a t t e r , b u t i t d

  • e

s i n c r e a s e e x p r e s s i v e n e s s . ) T h e i n t e n t i s a l s

  • d

i f f e r e n t h

  • w

e v e r : t h e r

  • l

e

  • f

a l t e r n a t e s i n a r e c

  • v

e r y b l

  • c

k i s t

  • p

r

  • v

i d e a l t e r n a t i v e i mp l e me n t a t i

  • n

s f

  • r

a n

  • p

e r a t i

  • n

, w h e r e a s e x c e p t i

  • n

s a r e n

  • r

ma l l y u s e d t

  • c

l e a n u p a n d /

  • r

t

  • d

i v e r t c

  • n

t r

  • l

f l

  • w

.

try { Alt1 } catch all { Alt2 }

slide-18
SLIDE 18

R e c

  • v

e r y b l

  • c

k s i n t e r ms

  • f

t r y / r

  • l

l b a c k

I ma g i n e w e h a v e a t r y / r

  • l

l b a c k c

  • n

s t r u c t , w h i c h w

  • r

k s l i k e t r y / c a t c h b u t r

  • l

l s b a c k a n y s t a t e c h a n g e s b e f

  • r

e t h e r

  • l

l b a c k b l

  • c

k e x e c u t e s . T h e n w e h a v e t h e f

  • l

l

  • w

i n g e q u i v a l e n c e :

e n s u r e a c c e p t b y Alt1 e l s e b y Alt2 . . .

e l s e b y Altn e l s e e r r

  • r

T h i s i s a l

  • c

a l ma c r

  • t

r a n s f

  • r

ma t i

  • n

, s

  • t

h e

  • r

i g i n a l r e c

  • v

e r y b l

  • c

k s y n t a x d

  • e

s n ’ t p r

  • v

i d e a n y g r e a t e r e x p r e s s i v e n e s s . H

  • w

e v e r i t h a s a n i c e s y n t a x t h a t d

  • e

s n ’ t r e q u i r e t h e r e p e t i t i

  • n
  • f

“ a s s e r t a c c e p t ( ) ” , a n d t h a t g u i d e s p r

  • g

r a mme r s t

  • w

a r d u s i n g t h e s a me a c c e p t a n c e t e s t f

  • r

e a c h

  • f

t h e a l t e r n a t e b l

  • c

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

  • f

t h e p r

  • g

r a m i n d e p e n d e n t l y

  • f

t h e d e t a i l s

  • f

a l l t h e b l

  • c

k s . A l l

  • w

i n g a n a c c e p t a n c e t e s t t

  • r

e f e r t

  • v

a r i a b l e s b

  • t

h b e f

  • r

e a n d a f t e r t h e a l t e r n a t e b l

  • c

k c a n b e s u p p

  • r

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

  • b

y t h e t e s t .

d e f a c c e p t ( ) { . . . } t r y { Alt1; a s s e r t a c c e p t ( ) } r

  • l

l b a c k a l l { t r y { Alt2; a s s e r t a c c e p t ( ) } … r

  • l

l b a c k a l l { Altn; a s s e r t a c c e p t ( ) } … }

slide-19
SLIDE 19

Wh y i s n ’ t r

  • l

l b a c k s u p p

  • r

t e d mo r e w i d e l y ?

I f r

  • l

l b a c k

  • b

a s e d e r r

  • r

r e c

  • v

e r y w a s p r

  • p
  • s

e d i n 1 9 7 5 a n d i s a g

  • d

i d e a , w h y i s i t

  • n

l y s u p p

  • r

t e d i n d a t a b a s e s a n d a f e w r e s e a r c h s y s t e ms , r a t h e r t h a n a c

  • mmo

n f e a t u r e

  • f

g e n e r a l

  • p

u r p

  • s

e p r

  • g

r a mmi n g l a n g u a g e s ? P

  • s

s i b l e r e a s

  • n

s : F a i l u r e t

  • f

u l l y a p p r e c i a t e c

  • s

t s

  • f

u n r e l i a b l e e r r

  • r

h a n d l i n g i n g e n e r a l

  • p

u r p

  • s

e p r

  • g

r a mmi n g ; P e r c e i v e d p e r f

  • r

ma n c e c

  • s

t ; P e r c e i v e d n a r r

  • w

a p p l i c a b i l i t y ( t

f a u l t

  • t
  • l

e r a n t s

  • f

t w a r e ” ,

  • r
  • n

l y t

  • c
  • n

c u r r e n t s

  • f

t w a r e , r a t h e r t h a n e r r

  • r

h a n d l i n g i n g e n e r a l ) ; P e r c e i v e d i mp l e me n t a t i

  • n

c

  • mp

l e x i t y ; P e r c e i v e d u s a g e c

  • mp

l e x i t y ( i n v a l i d ! I t ’ s r e a l l y s i mp l e ) ; P r

  • b

l e ms

  • f

i n t e r a c t i

  • n

w i t h I / O ( s

  • l

v e d ) ; F a i l u r e t

  • r

e c

  • g

n i s e s y n e r g i e s b e t w e e n f e a t u r e s e n a b l e d b y r

  • l

l b a c k ; T h e c

  • mp

u t i n g c

  • mmu

n i t y i s c

  • l

l e c t i v e l y p r e t t y f

  • r

g e t f u l

  • f

ma n y g

  • d

i d e a s . I ’ d l i k e t

  • a

d d r e s s p e r f

  • r

ma n c e c

  • s

t s a n d s y n e r g i e s b e t w e e n f e a t u r e s i n t h e n e x t f e w s l i d e s .

slide-20
SLIDE 20

F e a t u r e s f

  • r

c h e a p

T e x t r e a d s : “ S p e c i a l

  • f

f e r ! 5 f

  • r

t h e p r i c e

  • f

1 ( i s h ) : S t r

  • n

g e x c e p t i

  • n

g u a r a n t e e , C

  • n

c u r r e n t G C w r i t e b a r r i e r , R e v e r s i b l e e x e c u t i

  • n

, S i d e e f f e c t c

  • n

f i n e me n t , I n t e g r i t y e n f

  • r

c e me n t . T e r ms a n d c

  • n

d i t i

  • n

s a p p l y . ”

slide-21
SLIDE 21

I mp l e me n t i n g r

  • l

l b a c k

R a n d e l l e t a l ’ s 1 9 7 4 p a p e r d e s c r i b e s a p

  • s

s i b l e i mp l e me n t a t i

  • n
  • f

r

  • l

l b a c k , u s i n g a r e c u r s i v e c a c h e t

  • r

e c

  • r

d t h e v a l u e s

  • f

w

  • r

d s t h a t h a v e b e e n mo d i f i e d . E x p e r i me n t s w i t h t h i s a p p r

  • a

c h i n a P a s c a l s y s t e m i n 1 9 7 8 g a v e a me a s u r e d

  • v

e r h e a d

  • f

b e t w e e n 1 % a n d 1 1 % [ R a n d e l l 1 9 9 7 ] . T h i s ma y n

  • t

a c c u r a t e l y r e f l e c t w h a t t h e

  • v

e r h e a d w

  • u

l d b e i n a mo d e r n l a n g u a g e i mp l e me n t a t i

  • n

t h a t

  • p

t i mi s e s t h e r e s t

  • f

t h e c

  • d

e mo r e a g g r e s s i v e l y . I ' d l i k e t

  • s

u g g e s t a n a l t e r n a t i v e i mp l e me n t a t i

  • n

t h a t s h

  • u

l d r e d u c e t h e

  • v

e r h e a d f u r t h e r . ( T h i s i s

  • n

l y

  • n

e p

  • s

s i b l e t e c h n i q u e ; a n

  • t

h e r t h a t w

  • u

l d w

  • r

k i s t h e c

  • p

y

  • n
  • w

r i t e a p p r

  • a

c h u s e d i n [ A G V 2 1 1 ] . ) T r a i l i n g i s a t e c h n i q u e u s e d i n ma n y P r

  • l
  • g

i mp l e me n t a t i

  • n

s t

  • i

mp l e me n t b a c k t r a c k i n g s e a r c h . T h e e a r l i e s t p u b l i s h e d d e s c r i p t i

  • n
  • f

t r a i l i n g I c a n f i n d i s [ Wa r r e n & P e r e i r a 1 9 7 7 ] , d e s c r i b i n g t h e “

  • l

d P r

  • l
  • g

E n g i n e ” ( l a t e r v e r s i

  • n

s

  • f

w h i c h b e c a me k n

  • w

n a s Wa r r e n ’ s A b s t r a c t M a c h i n e ) . R

  • l

l b a c k i s s u f f i c i e n t l y s i mi l a r t

  • b

a c k t r a c k i n g t h a t w e c a n u s e a l mo s t t h e s a me t e c h n i q u e . ( I n t r a i l i n g w e

  • n

l y u n d

  • b

i n d i n g s ; f

  • r

r

  • l

l b a c k w e n e e d t

  • r

e s t

  • r

e

  • l

d v a l u e s . ) T h e s i mi l a r i t y t

  • b

a c k t r a c k i n g w a s a l r e a d y p

  • i

n t e d

  • u

t i n [ R a n d e l l 1 9 7 5 ] . A s h e n

  • t

e s , r e c

  • v

e r y p

  • i

n t s a r e l i k e l y t

  • b

e l e s s f r e q u e n t t h a n a r e c h

  • i

c e p

  • i

n t s i n b a c k t r a c k i n g . I n t y p i c a l p r

  • g

r a ms , w r i t e s a r e l e s s c

  • mmo

n t h a n r e a d s . [ V e c h e v & B a c

  • n

2 4 ] s a y s i n t h e c

  • n

t e x t

  • f

J a v a t h a t “ r e a d s t e n d t

  • u

t n u mb e r w r i t e s b y a r

  • u

n d f i v e t

  • n

e ” . T h i s r a t i

  • w

i l l b e h i g h e r f

  • r

f u n c t i

  • n

a l p r

  • g

r a mmi n g s t y l e s a n d l a n g u a g e s . We h a v e t

  • a

c c e p t t h e

  • v

e r h e a d

  • f

a w r i t e b a r r i e r ( e x t r a c

  • d

e a s s

  • c

i a t e d w i t h w r i t e s ) , b u t w

  • u

l d l i k e t

  • a

v

  • i

d n e e d i n g a r e a d b a r r i e r . We ’ d a l s

  • l

i k e t

  • p

t i mi s e

  • u

t a s mu c h

  • f

t h e w r i t e b a r r i e r

  • v

e r h e a d a s p

  • s

s i b l e .

slide-22
SLIDE 22

I mp l e me n t i n g r

  • l

l b a c k

T h i s d e s c r i p t i

  • n

w i l l b e i n t e r ms

  • f

a me mo r y mo d e l t h a t h a s v a l u e s s t

  • r

e d i n l

  • c

a t i

  • n

s . A l l

  • c

a t i

  • n

a l w a y s p r

  • d

u c e s f r e s h l

  • c

a t i

  • n

s . I n p r a c t i c e w e c a n r e p r e s e n t l

  • c

a t i

  • n

s a s p

  • i

n t e r s , w h i c h mi g h t n e e d t

  • b

e r e w r i t t e n i f a n

  • b

j e c t i s mo v e d i n me mo r y . N

  • t

e t h a t a w r i t e i s n

  • t

n e c e s s a r i l y a l a n g u a g e

  • l

e v e l mu t a t i

  • n

; w r i t e s a l s

  • c

c u r i n t h e e x e c u t i

  • n
  • f

p u r e f u n c t i

  • n

a l p r

  • g

r a ms . We k e e p a n u n d

  • s

t a c k

  • f

( l

  • c

a t i

  • n

,

  • l

d v a l u e ) p a i r s r e c

  • r

d e d b y t h e w r i t e b a r r i e r . T

  • r
  • l

l b a c k , w e r e s t

  • r

e

  • l

d v a l u e s f r

  • m

t h e u n d

  • s

t a c k i n r e v e r s e

  • r

d e r . F

  • r

e a c h l

  • c

a t i

  • n

, t h e u n d

  • s

t a c k

  • n

l y n e e d s t

  • s

t

  • r

e t h e

  • l

d v a l u e f

  • r

t h e f i r s t w r i t e a f t e r a r e c

  • v

e r y p

  • i

n t , b u t t h e r e i s n

  • h

a r m

  • t

h e r t h a n me mo r y u s e c a u s e d b y s t

  • r

i n g e n t r i e s f

  • r

a d d i t i

  • n

a l w r i t e s . T h i s i s t h e ma i n d i f f e r e n c e b e t w e e n t h i s i mp l e me n t a t i

  • n

a n d t h e r e c u r s i v e c a c h e u s e d b y R a n d e l l e t a l . T h e i r w r i t e b a r r i e r w a s c

  • n

d i t i

  • n

a l a n d r e q u i r e d t r a c k i n g w h i c h w

  • r

d s h a d b e e n mo d i f i e d s i n c e t h e l a s t e n t r y t

  • a

r e c

  • v

e r y b l

  • c

k . U n c

  • n

d i t i

  • n

a l b a r r i e r s a r e f a s t e r , a n d i n p r a c t i c e w e w i l l b e a b l e t

  • r

e mo v e mo s t b a r r i e r s b y s t a t i c a n a l y s i s .

slide-23
SLIDE 23

H

  • w

f a r ?

E v e r y w r i t e a d d s a l

  • c

a t i

  • n

p

  • i

n t e r a n d

  • l

d v a l u e t

  • t

h e t r a i l s t a c k . T

  • ma

i n t a i n c

  • mp
  • s

i t i

  • n

a l i t y , w e w

  • u

l d i d e a l l y l i k e a l l c a l l s t

  • s

a t i s f y t h e s t r

  • n

g e x c e p t i

  • n

g u a r a n t e e . B u t r e t a i n i n g a l l t h e i n f

  • r

ma t i

  • n

n e e d e d t

  • r
  • l

l b a c k t

  • t

h e b e g i n n i n g

  • f

e x e c u t i

  • n

w

  • u

l d i n t r

  • d

u c e a s p a c e l e a k . S

  • h
  • w

f a r d

  • w

e n e e d t

  • b

e a b l e t

  • r
  • l

l b a c k ? O n e p

  • s

s i b l e a n s w e r a s s u me s t h a t t h e p r

  • g

r a m i s s t r u c t u r e d a s a n e v e n t l

  • p

(

  • r

s e t

  • f

c

  • n

c u r r e n t e v e n t l

  • p

s ) . T h i s i s a p

  • p

u l a r p r

  • g

r a mmi n g mo d e l w i t h ma n y a d v a n t a g e s . T h e e v e n t l

  • p

s t r u c t u r e c a n b e i mp l e me n t e d i n a f r a me w

  • r

k

  • r

b y t h e p r

  • g

r a m i t s e l f . S i n c e v a t s d

  • n
  • t

s h a r e mu t a b l e s t a t e , w e c a n r e c

  • r

d r

  • l

l b a c k i n f

  • r

ma t i

  • n

i n d e p e n d e n t l y f

  • r

e a c h v a t . T y p i c a l l y e a c h e v e n t

  • l
  • p

t u r n i s t r i g g e r e d b y p r

  • c

e s s i n g

  • f

a n i n c

  • mi

n g me s s a g e , i n i t i a l l y w i t h a n e mp t y s t a c k . T h e r e f

  • r

e , w e n e e d

  • n

l y b e a b l e t

  • r
  • l

l b a c k t

  • t

h e b e g i n n i n g

  • f

t h e l a s t t u r n b

  • u

n d a r y i n

  • r

d e r t

  • ma

i n t a i n t h e s t r

  • n

g e x c e p t i

  • n

g u a r a n t e e . F a i r l y s h

  • r

t e v e n t

  • l
  • p

t u r n s a r e d e s i r a b l e f

  • r
  • t

h e r r e a s

  • n

s ( e . g . r e s p

  • n

s i v e n e s s t

  • i

n c

  • mi

n g me s s a g e s ) , w h i c h i n p r a c t i c e l i mi t s t h e s i z e

  • f

r

  • l

l b a c k i n f

  • r

ma t i

  • n

. A l t e r n a t i v e l y , w e c

  • u

l d j u s t f l u s h t h e c

  • mp

a c t e d t r a i l s t a c k t

  • p

e r s i s t e n t s t

  • r

a g e , t a k i n g a d v a n t a g e

  • f

t h e f a c t t h a t d i s k i s c h e a p a n d t h a t e a r l i e r p

  • r

t i

  • n

s

  • f

t h e t r a i l a r e u n l i k e l y t

  • b

e a c c e s s e d .

slide-24
SLIDE 24

O p t i mi s i n g r

  • l

l b a c k

We h a v e t w

  • ma

i n s

  • u

r c e s

  • f

i d e a s :

  • p

t i mi s a t i

  • n

s f

  • r

t r a i l i n g i n P r

  • l
  • g

, a n d w r i t e b a r r i e r e l i s i

  • n

f

  • r

c

  • n

c u r r e n t G C . M

  • s

t

  • f

t h e t r a i l i n g

  • p

t i mi s a t i

  • n

s a r e b a s e d

  • n

t h e i d e a t h a t w e

  • n

l y n e e d t

  • r

e t a i n s u f f i c i e n t i n f

  • r

ma t i

  • n

t

  • g

e t t h e s t a t e b a c k t

  • a

r e c

  • v

e r y p

  • i

n t , n

  • t

a n y a r b i t r a r y e x e c u t i

  • n

p

  • i

n t . A l t h

  • u

g h i t ma y b e p

  • s

s i b l e t

  • e

l i d e w r i t e b a r r i e r s b a s e d

  • n

r u n

  • t

i me t e s t s , t h e c

  • s

t

  • f

t h e t e s t

  • f

f s e t s t h e s a v i n g , s

  • t

h i s i s n

  • t

w

  • r

t h w h i l e (

  • r

w a s n ’ t f

  • r

P r

  • l
  • g

[ S c h r i j v e r s a n d D e mo e n 1 9 8 8 § 2 . 1 ] ) . T h e mo s t i mp

  • r

t a n t

  • p

t i mi z a t i

  • n

s c

  • me

f r

  • m

s t a t i c a n a l y s i s : S

  • me

c

  • d

e i s s t a t i c a l l y k n

  • w

n n

  • t

t

  • c
  • n

t a i n r e c

  • v

e r y p

  • i

n t s . Wr i t i n g t

  • a

l

  • c

a t i

  • n
  • n

l y r e q u i r e s a n u n d

  • e

n t r y i f t h e l

  • c

a t i

  • n

e x i s t e d a t t h e l a s t r e c

  • v

e r y p

  • i

n t , a n d

  • n

l y f

  • r

t h e f i r s t w r i t e a f t e r a r e c

  • v

e r y p

  • i

n t . We c a n h

  • i

s t b a r r i e r s a b

  • v

e l

  • p

s t h a t c

  • n

t a i n n

  • r

e c

  • v

e r y p

  • i

n t s . I f a l

  • p

i s p r

  • b

a b l y g

  • i

n g t

  • w

r i t e t

  • a

r a n g e

  • f

l

  • c

a t i

  • n

s , w e c a n t r a i l t h a t r a n g e , a v

  • i

d i n g s

  • me
  • v

e r h e a d a s s

  • c

i a t e d w i t h t r a i l i n g e a c h l

  • c

a t i

  • n

. S i mi l a r l y f

  • r

s t e r e

  • t

y p e d p a t t e r n s

  • f

w r i t e s t

  • a

n

  • b

j e c t ’ s f i e l d s . I f w e k n

  • w

t h a t a p r

  • c

e d u r e i s p a s s e d a l

  • c

a t i

  • n

t h a t i t w r i t e s t

  • ,

w e c a n c h a n g e a l l c a l l e r s t

  • t

r a i l t h a t l

  • c

a t i

  • n

b e f

  • r

e t h e c a l l , a n d n

  • w

t h e c a l l e e d

  • e

s n

  • t

n e e d t

  • .

( T h e a d v a n t a g e i s t h a t w e mi g h t b e a b l e t

  • f

u r t h e r

  • p

t i mi z e b y h

  • i

s t i n g , me r g i n g e t c . i n t h e c a l l e r s . )

slide-25
SLIDE 25

O p t i mi s i n g me mo r y u s a g e

Wr i t e s t

  • l
  • c

a t i

  • n

s t h a t n

  • l
  • n

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

  • u

s v a l u e a t a l

  • c

a t i

  • n

i s k n

  • w

n t

  • b

e n u l l , w e c a n s t

  • r

e j u s t a t a g g e d l

  • c

a t i

  • n

r a t h e r t h a n a l s

  • s

t

  • r

i n g t h e n u l l . We s h

  • u

l d ma k e s u r e t h a t t h e u n d

  • s

t a c k r e u s e s t h e s a me me mo r y b e t w e e n t u r n b

  • u

n d a r i e s t

  • a

v

  • i

d c a c h e p

  • l

l u t i

  • n

( s i mi l a r a r g u me n t t

  • [

G

  • n

ç a l v e s a n d A p p e l 1 9 9 5 ] ) . We c a n “ c

  • mp

r e s s ” t h e u n d

  • s

t a c k ( p

  • s

s i b l y d u r i n g G C ) t

  • r

e mo v e r e d u n d a n t e n t r i e s .

slide-26
SLIDE 26

C

  • n

c u r r e n t G C

I n g e n e r a l , g a r b a g e c

  • l

l e c t i

  • n

w

  • r

k s b y c

  • n

s e r v a t i v e l y i d e n t i f y i n g a t l e a s t a l l l i v e

  • b

j e c t s , a n d t h e n d i s c a r d i n g

  • b

j e c t s n

  • t

i n t h a t s e t . A l t h

  • u

g h s t r i c t l y s p e a k i n g

  • n

l y a c

  • n

s e r v a t i v e s e t

  • f
  • b

j e c t s n e e d s t

  • b

e i d e n t i f i e d , i t ’ s e a s i e r t

  • u

n d e r s t a n d ma n y

  • f

t h e s e a l g

  • r

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

  • b

j e c t s . I n c

  • n

c u r r e n t G C , t h e a i m i s t

  • k

e e p t h e mu t a t

  • r

r u n n i n g mo s t

  • f

t h e t i me w h i l e t h e c

  • n

s e r v a t i v e g r a p h i s c

  • n

s t r u c t e d . I n “ s n a p s h

  • t
  • a

t

  • t

h e

  • b

e g i n n i n g ” c

  • n

c u r r e n t G C a l g

  • r

i t h ms , t h e c

  • n

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

  • b

j e c t g r a p h a t t h e t i me

  • f

t h e s n a p s h

  • t

. I f t h e mu t a t

  • r

c h a n g e s a n e d g e i n t h e c u r r e n t

  • b

j e c t g r a p h , t h e

  • l

d e d g e mu s t b e k e p t . T h i s i s t y p i c a l l y d

  • n

e u s i n g a Y u a s a w r i t e b a r r i e r ( n a me d f

  • r

T a i i c h i Y u a s a ) w h i c h r e c

  • r

d s t h e

  • l

d v a l u e i f i t i s a n

  • n
  • n

u l l p

  • i

n t e r . A t r a i l e d w r i t e b a r r i e r i s s i mi l a r t

  • a

Y u a s a w r i t e b a r r i e r , e x c e p t t h a t i t mu s t a l s

  • r

e c

  • r

d t h e l

  • c

a t i

  • n
  • f

t h e u p d a t e , a n d mu s t

  • p

e r a t e f

  • r

n

  • n
  • p
  • i

n t e r w r i t e s . S i n c e t h e t r a i l s t a c k c

  • n

t a i n s a l l t h e p

  • i

n t e r s t h a t a Y u a s a b a r r i e r w

  • u

l d h a v e r e c

  • r

d e d , w e g e t t h e r e q u i r e d w r i t e b a r r i e r f

  • r

c

  • n

c u r r e n t g a r b a g e c

  • l

l e c t i

  • n

“ f

  • r

f r e e ” . A n

  • t

h e r w a y

  • f

t h i n k i n g

  • f

t h i s i s t h a t i f w e a r e a b l e t

  • r
  • l

l b a c k t

  • a

r e c

  • v

e r y p

  • i

n t , w e n e c e s s a r i l y r e t a i n t h e l i v e s e t a t t h a t r e c

  • v

e r y p

  • i

n t .

slide-27
SLIDE 27

O p t i mi s i n g c

  • n

c u r r e n t G C

I f w e a s s u me t h a t w e h a v e a n e v e n t

  • l
  • p

s y s t e m a n d a r e u s i n g t r a i l i n g , t h e r e a r e w a y s t

  • p

t i mi s e G C t

  • r

e d u c e t h e a mo u n t

  • f

t r a c i n g w e n e e d t

  • d
  • .

T h e r e c

  • v

e r y p

  • i

n t a t a t u r n b

  • u

n d a r y i s a g

  • d

p l a c e t

  • d
  • a

G C s n a p s h

  • t

, b e c a u s e t h e r e i s n

  • s

t a c k a n d t y p i c a l l y l e s s “ e p h e me r a l ” l i v e d a t a . I f a G C i n a c

  • n

v e n t i

  • n

a l s y s t e m h a p p e n s t

  • r

u n w h e n t h e r e a r e ma n y

  • b

j e c t s r e a c h a b l e f r

  • m

t h e s t a c k , t h e n i t w i l l n e e d t

  • t

r a c e t h

  • s

e

  • b

j e c t s e v e n i f t h e y w

  • u

l d h a v e b e e n d e a d s

  • n

a f t e r w a r d . I n e v e n t

  • l
  • p

s y s t e ms i t ’ s c

  • mmo

n t

  • a

l l

  • c

a t e

  • b

j e c t s t h a t a r e g u a r a n t e e d t

  • b

e d e a d a t t h e e n d

  • f

t h e t u r n . U n l e s s w e n e e d a n “ e me r g e n c y ” G C d u r i n g a t u r n , t h e p

  • l

i c y

  • f

s c h e d u l i n g G C a t t u r n b

  • u

n d a r i e s w i l l e n s u r e t h e s e

  • b

j e c t s a r e n e v e r t r a c e d . G e n e r a t i

  • n

a l G C i s a l mo s t a l w a y s b e n e f i c i a l . A s s u me w e ’ r e d

  • i

n g t h a t , a n d w e h a v e p e r

  • t

a s k n u r s e r i e s , w i t h n u r s e r y c

  • l

l e c t i

  • n

f

  • r

a t a s k b e i n g i n d e p e n d e n t

  • f
  • t

h e r t a s k s . A s s u me t h a t a p a r t i c u l a r n u r s e r y c

  • l

l e c t i

  • n

i s s n a p s h

  • t

t e d a t a t u r n b

  • u

n d a r y . H

  • w

c a n w e r e d u c e i t s c

  • s

t ? We ’ r e n

  • t

g

  • i

n g t

  • t

r y t

  • c
  • l

l e c t a n y t h i n g i n t h e h e a p – i . e . t h e

  • l

d e r g e n e r a t i

  • n

( s ) – j u s t t h e n u r s e r y . Wh a t i s t h e mi n i mu m w e n e e d t

  • t

r a c e ? P

  • i

n t e r s i n t

  • t

h e n u r s e r y f r

  • m

me s s a g e s s e n t i n t h i s t u r n P

  • i

n t e r s i n t

  • t

h e n u r s e r y t h a t w e r e s t

  • r

e d i n t

  • t

h e h e a p a l l

  • f

t h e s e l

  • c

a t i

  • n

s a r e

  • n

t h e ← t r a i l s t a c k !

slide-28
SLIDE 28

R e v e r s i b l e e x e c u t i

  • n

a n d d e b u g g i n g

I f w e c a n r

  • l

l b a c k t

  • a

n y r e c

  • v

e r y p

  • i

n t i n n

  • r

ma l e x e c u t i

  • n

, w e c a n a l s

  • d
  • s
  • w

h e n d e b u g g i n g . T h e e a r l i e s t r e f e r e n c e I c a n f i n d t

  • t

h i s i d e a i s a 1 9 7 3 C A C M p a p e r b y M a r v i n Z e l k

  • v

i t z . T h a t p a p e r a l s

  • n
  • t

e s t h e c

  • n

n e c t i

  • n

t

  • b

a c k t r a c k i n g . I t r e f e r e n c e d a n i mp l e me n t a t i

  • n

f

  • r

P L / I u s i n g a w r i t e b a r r i e r , w i t h a n

  • v

e r a l l t i me

  • v

e r h e a d

  • f

r

  • u

g h l y 7 % a n d a s p a c e

  • v

e r h e a d

  • f

3

  • 6

% . T h i s c

  • mp

a r e s t

  • g

d b ’ s r e c e n t i mp l e me n t a t i

  • n
  • f

r e v e r s e d e b u g g i n g w h i c h i s t h

  • u

s a n d s

  • f

t i me s s l

  • w

e r ( a p p a r e n t l y b e c a u s e i t u s e s s i n g l e

  • s

t e p p i n g ? ) We c a n g

  • b

a c k f u r t h e r t h a n t h e l a s t t u r n b

  • u

n d a r y i f w e t a k e c h e c k p

  • i

n t s ,

  • r

i f w e k e e p t h e t r a i l s t a c k a n d t h e f i n a l s t a t e . We c a n a l s

  • r
  • l

l f

  • r

w a r d f r

  • m

a n y r e c

  • v

e r y p

  • i

n t . T

  • f
  • l

l

  • w

t h e s a me p a t h a s t h e

  • r

i g i n a l e x e c u t i

  • n

, w e n e e d t

  • h

a v e l

  • g

g e d a l l i n p u t s t

  • t

h e v a t ( i . e . i n c

  • mi

n g me s s a g e s a n d s

  • u

r c e s

  • f

n

  • n

d e t e r mi n i s m) . We c a n p

  • t

e n t i a l l y r e i f y c h e c k p

  • i

n t s a n d r e p l a y l

  • g

s a n d e x p

  • s

e t h e m t

  • a

p p l i c a t i

  • n

s .

slide-29
SLIDE 29

C

  • n

f i n i n g s i d e e f f e c t s

S

  • me

l a n g u a g e s h a v e t y p e s y s t e ms a n d /

  • r

e f f e c t s y s t e ms t h a t c a n e n f

  • r

c e t h a t s

  • me

c

  • d

e d

  • e

s n

  • t

h a v e s i d e e f f e c t s ( s u c h a s mu t a t i

  • n
  • r

s e n d i n g me s s a g e s ) . H

  • w

e v e r , w h a t i f w e a r e n

  • t

i n s u c h a l a n g u a g e ,

  • r

w e w a n t t

  • c
  • n

f i n e t h e e f f e c t s

  • f

c

  • d

e t h a t d

  • e

s n ' t s a t i s f y t h e s e c

  • n

s t r a i n t s ? F

  • r

e x a mp l e : a t t h e F u t u r e

  • f

P r

  • g

r a mmi n g Wo r k s h

  • p

a t t h e p r e

  • c
  • n

f e r e n c e t h e r e w a s a f a n t a s t i c p r e s e n t a t i

  • n

b y J

  • e

l G a l e n s

  • n
  • n

C

  • d

e H i n t , w h i c h d

  • e

s a b a c k t r a c k i n g s e a r c h f

  • r

c

  • d

e s a t i s f y i n g g i v e n c r i t e r i a . I n

  • r

d e r t

  • d
  • t

h i s i t n e e d s t

  • a

c t u a l l y e x e c u t e t h e c

  • d

e , b u t i t a l s

  • h

a s t

  • u

n d

  • a

n y s i d e e f f e c t s . O n t h e J V M t h i s i n c u r s s i g n i f i c a n t

  • v

e r h e a d . Wi t h s u p p

  • r

t f r

  • m

t h e l a n g u a g e i mp l e me n t a t i

  • n

, w e c a n i mp l e me n t t h i s mu c h mo r e e f f i c i e n t l y . C a v e a t : i n

  • r

d e r t

  • p

r u n e d u p l i c a t e s t a t e s f r

  • m

t h e s e a r c h , t h e u n d

  • s

t a c k i s n ' t q u i t e s u f f i c i e n t a n d t h i s a p p l i c a t i

  • n

ma y n e e d a w r i t e b a r r i e r w i t h s l i g h t l y h e a v i e r

  • v

e r h e a d . H

  • w

e v e r , mo s t

  • f

t h e

  • p

t i mi s a t i

  • n

s w e ' v e d e s c r i b e d a r e s t i l l a p p l i c a b l e . S i d e e f f e c t c

  • n

f i n e me n t c a n b e u s e d a s p a r t

  • f

a mo r e g e n e r a l c a p a b i l i t y

  • b

a s e d c

  • n

f i n e me n t me c h a n i s m.

slide-30
SLIDE 30

I n t e g r i t y e n f

  • r

c e me n t

S u p p

  • s

e t h a t w e h a v e d e f i n e d i n v a r i a n t s f

  • r

c e r t a i n a b s t r a c t i

  • n

s , b u t w e c

  • n

s i d e r c h e c k i n g t h e i n v a r i a n t s t

  • e

x p e n s i v e t

  • r

e p e a t f

  • r

e v e r y n e w

  • b

j e c t

  • r

e v e r y mu t a t i

  • n

. N

  • t

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

  • f
  • b

j e c t s , w h i c h i s

  • n

e r e a s

  • n

w h y t h e y ma y b e e x p e n s i v e t

  • c
  • mp

u t e . I n s t e a d , w e w a n t t

  • c

h e c k i n t e g r i t y

  • n

l y

  • f
  • b

j e c t s t r u c t u r e s t h a t b e c

  • me

p a r t

  • f

t h e p e r s i s t e n t s t a t e a f t e r a n e v e n t

  • l
  • p

t u r n . T h e u n d

  • s

t a c k t e l l s u s w h i c h

  • b

j e c t s t h

  • s

e a r e ( t h a t i s , w h i c h

  • b

j e c t s h a v e c h a n g e d

  • r

b e e n c r e a t e d , a n d a r e p

  • t

e n t i a l l y l i v e ) . T h e r e f

  • r

e , w e c a n e n u me r a t e t h

  • s

e

  • b

j e c t s , c h e c k t h e i r i n v a r i a n t s , a n d r

  • l

l b a c k t h e t u r n i f t h i s c h e c k i n g f a i l s . We c a n a l s

  • r

e p l a y t h e t u r n w i t h mo r e p r e c i s e a n d e x p e n s i v e i n v a r i a n t c h e c k i n g t u r n e d

  • n

, a n d s i g n a l a n e r r

  • r

f r

  • m

p r e c i s e l y t h e p

  • i

n t a t w h i c h a n i n v a r i a n t f a i l s . I f i t f a i l s w i t h i n a r e c

  • v

e r y b l

  • c

k , a n d t h e a l t e r n a t e i mp l e me n t a t i

  • n
  • f

t h e b l

  • c

k i s c

  • r

r e c t , t h i s c

  • u

l d a l l

  • w

t h e e r r

  • r

t

  • b

e c

  • r

r e c t e d – a n d t h e n t h e p r

  • g

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

  • a

c h ma k e s

  • r

t h

  • g
  • n

a l p e r s i s t e n c e mo r e a t t r a c t i v e , s i n c e w e c a n b e mo r e c

  • n

f i d e n t t h a t t h e l

  • n

g

  • t

e r m p e r s i s t e n t s t a t e w i l l n

  • t

b e c

  • me

c

  • r

r u p t e d . T h e r e a r e s

  • me

s i mi l a r i t i e s w i t h w

  • r

k

  • n

G C a s s e r t i

  • n

s a n d a s y n c h r

  • n
  • u

s a s s e r t i

  • n

s , a n d i t ma y b e u s e f u l t

  • c
  • mb

i n e t h e s e i d e a s .

slide-31
SLIDE 31

D i s t r i b u t e d e r r

  • r

r e c

  • v

e r y

C l a r i f i c a t i

  • n

: “ d i s t r i b u t e d ” d

  • e

s n

  • t

n e c e s s a r i l y me a n a c r

  • s

s a n e t w

  • r

k ; c

  • mmu

n i c a t i n g n

  • d

e s c a n b e

  • n

t h e s a me ma c h i n e . I n a v a t

  • b

a s e d e v e n t l

  • p

mo d e l , w e c a n t r e a t a n y s u b s e t

  • f

v a t s a s a “ n

  • d

e ” . F a u l t t

  • l

e r a n c e i n d i s t r i b u t e d me s s a g e p a s s i n g a n d /

  • r

s h a r e d me mo r y s y s t e ms h a s b e e n a w e l l

  • s

t u d i e d f i e l d f

  • r

a t l e a s t 4 y e a r s . H

  • w

e v e r , a d

  • p

t i

  • n
  • f

f a u l t

  • t
  • l

e r a n t p r

  • t
  • c
  • l

s h a s b e e n l i mi t e d . T h i s i s p r

  • b

a b l y d u e t

  • t

h e c

  • mp

l e x i t y

  • f

mo s t e x i s t i n g p r

  • t
  • c
  • l

s t h a t r e q u i r e c l

  • s

e c

  • r

d i n a t i

  • n

b e t w e e n n

  • d

e s . O n e

  • f

t h e ma i n p r

  • b

l e ms i s t h e “ d

  • mi

n

  • e

f f e c t ” , i n w h i c h e r r

  • r

r e c

  • v

e r y

  • n

a g i v e n n

  • d

e c a n r e q u i r e c a s c a d i n g r

  • l

l b a c k s

  • n
  • t

h e r n

  • d

e s . T h e f

  • l

k w i s d

  • m
  • n

d i s t r i b u t e d f a u l t t

  • l

e r a n c e h a s t e n d e d t

  • a

s s u me t h a t t h e d

  • mi

n

  • e

f f e c t i s i n e v i t a b l e . We n e e d s

  • me

t h i n g s i mp l e r a n d mo r e c

  • mp
  • s

a b l e ! K e n i s a f a mi l y

  • f

p r

  • t
  • c
  • l

s t h a t p r

  • v

i d e e r r

  • r

r e c

  • v

e r y f

  • r

d e t e c t e d f a u l t s w i t h

  • u

t t h e d

  • mi

n

  • e

f f e c t . I mp l e me n t a t i

  • n

s : Wa t e r k e n f

  • r

J a v a / J

  • e
  • E

p r

  • g

r a ms , d e v e l

  • p

e d b y T y l e r C l

  • s

e C K e n f

  • r

C p r

  • g

r a ms M a c e K e n , i n t e g r a t e d w i t h t h e M a c e d i s t r i b u t e d

  • s

y s t e ms t

  • l

k i t b y H y

  • u

n K y u C h

  • S

c h e m e K e n f

  • r

S c h e m e v 8

  • k

e n , f

  • r

G

  • g

l e ’ s v 8 i mp l e me n t a t i

  • n
  • f

J a v a s c r i p t . R e s e a r c h a t H e w l e t t

  • P

a c k a r d u s e s t h e t e r m C O V R ( C

  • mp
  • s

a b l e O u t p u t

  • V

a l i d R e s i l i e n c y ) t

  • d

e s c r i b e t h e p r

  • p

e r t i e s

  • f

t h i s p r

  • t
  • c
  • l

f a mi l y .

slide-32
SLIDE 32

O u t p u t v a l i d i t y

O u t p u t v a l i d i t y i s t h e p r

  • p

e r t y t h a t t h e

  • u

t p u t s

  • f

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

  • f

f a u l t s a r e

  • u

t p u t s t h a t c

  • u

l d a l s

  • h

a v e

  • c

c u r r e d u n d e r f a u l t

  • f

r e e

  • p

e r a t i

  • n

. N

  • t

e t h a t t h i s d

  • e

s n ’ t r e q u i r e t h a t f a u l t s h a v e n

  • i

n f l u e n c e

  • n

t h e

  • u

t p u t . D i s t r i b u t e d me s s a g e

  • p

a s s i n g s y s t e ms a r e n

  • r

ma l l y n

  • n

d e t e r mi n i s t i c , b e c a u s e t h e a r r i v a l

  • r

d e r

  • f

me s s a g e s d e p e n d s

  • n

t i mi n g . F a u l t s c a n i n f l u e n c e w h i c h n

  • n

d e t e r mi n i s t i c c h

  • i

c e s a r e ma d e , b u t t h i s s h

  • u

l d n

  • t

a f f e c t c

  • r

r e c t n e s s . A s s u mp t i

  • n

s : M e s s a g e s a r e t r a n s m i t t e d a n d r e c e i v e d b y n

  • d

e s ,

  • v

e r a c

  • mmu

n i c a t i

  • n

me d i u m t h a t s

  • me

t i me s l

  • s

e s

  • r

d u p l i c a t e s me s s a g e s . S

  • a

n

  • d

e ma y t r a n s mi t a me s s a g e t h a t i s n

  • t

r e c e i v e d ,

  • r

t h a t i s r e c e i v e d mo r e t h a n

  • n

c e b y t h e d e s t i n a t i

  • n

n

  • d

e . We a s s u me t h a t me s s a g e s a r e

  • n

l y r e c e i v e d a t t h e i r i n t e n d e d d e s t i n a t i

  • n

n

  • d

e a s s p e c i f i e d b y t h e t r a n s mi t t e r . A g

  • d

w a y t

  • d
  • t

h i s i s f

  • r

e a c h me s s a g e t

  • i

d e n t i f y i t s r e c i p i e n t b y a n u n f

  • r

g e a b l e c a p a b i l i t y , w h e r e a c a p a b i l i t y i mp l i e s a p a r t i c u l a r d e s t i n a t i

  • n

n

  • d

e . I f c a p a b i l i t i e s c a n a l s

  • b

e s e n t i n me s s a g e s , t h i s a l l

  • w

s d y n a mi c p a t t e r n s

  • f

c

  • l

l a b

  • r

a t i

  • n

t

  • b

e e s t a b l i s h e d s e c u r e l y . O v e r a n

  • p

e n c

  • mmu

n i c a t i

  • n

me d i u m, me e t i n g t h e s e a s s u mp t i

  • n

s r e q u i r e s c r y p t

  • g

r a p h y , i n c l u d i n g a k e y ma n a g e me n t s y s t e m t h a t a s s i g n s k e y s t

  • n
  • d

e s . We

  • n

l y c l a i m t

  • r

e c

  • v

e r f r

  • m

d e t e c t e d ( c r a s h

  • r

e s t a r t ) f a u l t s t h a t d

  • n
  • t

i n v

  • l

v e l

  • s

s

  • f

a n

  • d

e ’ s p e r s i s t e n t s t a t e .

slide-33
SLIDE 33

H

  • w

K e n / C O V R w

  • r

k s

A l l c

  • mmu

n i c a t i

  • n

b e t w e e n n

  • d

e s i s b y me s s a g e p a s s i n g a c c

  • r

d i n g t

  • t

h e r u l e s b e l

  • w

. E a c h n

  • d

e h a s a s t a t e t h a t i s c h e c k p

  • i

n t e d r e a s

  • n

a b l y f r e q u e n t l y , a n d i n d e p e n d e n t l y

  • f
  • t

h e r n

  • d

e s . T h e s t a t e i n c l u d e s i n c

  • mi

n g a n d

  • u

t g

  • i

n g me s s a g e s . C h e c k p

  • i

n t s a r e w r i t t e n d u r a b l y t

  • t

h e n

  • d

e ’ s p e r s i s t e n t s t

  • r

a g e . I f a n

  • d

e f a i l s , i t r e s t

  • r

e s f r

  • m

t h e l a s t c

  • mp

l e t e c h e c k p

  • i

n t . ( I t s b e h a v i

  • u

r i n t h i s c a s e c a n ’ t b e d i s t i n g u i s h e d f r

  • m

a n

  • d

e t h a t h a d b e e n r u n n i n g mo r e s l

  • w

l y . ) O u t g

  • i

n g me s s a g e s a r e r e l e a s e d i n t h e s a me a t

  • mi

c a c t i

  • n

a s c h e c k p

  • i

n t i n g . We n e e d t h i s a n y w a y f

  • r

l

  • c

a l e r r

  • r

r e c

  • v

e r y . We a r e i n c u r r i n g a l a t e n c y c

  • s

t f

  • r

d e l a y i n g r e l e a s e

  • f
  • u

t g

  • i

n g me s s a g e s u n t i l a t u r n i s c

  • mmi

t t e d , b u t w e a r e p a y i n g t h i s c

  • s

t

  • n

l y

  • n

c e f

  • r

l

  • c

a l e r r

  • r

r e c

  • v

e r y a n d f

  • r

K e n . We n e e d t

  • c

h e c k p

  • i

n t e v e r y t i me w e r e l e a s e me s s a g e s t

  • a

n

  • t

h e r n

  • d

e , b u t n

  • t

n e c e s s a r i l y a t e v e r y t u r n . R e l e a s e d me s s a g e s a r e p e r i

  • d

i c a l l y r e t r a n s m i t t e d u n t i l t h e y a r e a c k n

  • w

l e d g e d . T h e y c a n b e d e l e t e d f r

  • m

t h e s t a t e

  • n

l y a f t e r t h e y a r e a c k n

  • w

l e d g e d . D u p l i c a t e a c k n

  • w

l e d g e me n t s a r e d i s c a r d e d . A r e c e i v e d me s s a g e i s n

  • t

a c k n

  • w

l e d g e d u n t i l a f t e r i t h a s b e e n r e c

  • r

d e d i n a c h e c k p

  • i

n t . ( [ H P L

  • 2

1

  • 1

5 5 ] s a y s a c k n

  • w

l e d g e me n t s s h

  • u

l d b e d e l a y e d u n t i l t h e me s s a g e h a s b e e n p r

  • c

e s s e d . T h i s i s n ’ t n e c e s s a r y f

  • r
  • u

t p u t v a l i d i t y i f a p p l i c a t i

  • n

s d

  • n
  • t

s e e a c k n

  • w

l e d g e me n t s . ) R e c e i v e d me s s a g e s t h a t a n

  • d

e h a s a l r e a d y r e c

  • r

d e d a r e r e a c k n

  • w

l e d g e d a n d t h e n d i s c a r d e d . I t ma y a l s

  • b

e d e s i r a b l e t

  • e

n f

  • r

c e me s s a g e

  • r

d e r i n g g u a r a n t e e s s u c h a s p a i r w i s e F I F O

  • r

d e r i n g . T h a t ’ s i t !

slide-34
SLIDE 34

Wh a t a b

  • u

t d e t e r mi n i s t i c e r r

  • r

s ?

C O V R p r

  • t
  • c
  • l

s a r e s u i t e d t

  • r

e c

  • v

e r i n g f r

  • m

e r r

  • r

s t h a t a r e n

  • n

d e t e r mi n i s t i c ( s u c h a s h a r d w a r e f a i l u r e s

  • r

t e mp

  • r

a r y r e s

  • u

r c e e x h a u s t i

  • n

) , s

  • t

h a t t h e r e i s a g

  • d

c h a n c e

  • f

a v

  • i

d i n g t h e e r r

  • r
  • n

r e c

  • v

e r y . We s h

  • u

l d u s e

  • t

h e r me c h a n i s ms t

  • r

e c

  • v

e r f r

  • m

d e t e r mi n i s t i c a s y n c h r

  • n
  • u

s e r r

  • r

s . P

  • s

s i b i l i t i e s i n c l u d e : E r l a n g ’ s s u p e r v i s i

  • n

h i e r a r c h i e s a n d p r

  • c

e s s l i n k i n g E ’ s s ma s h e d p r

  • mi

s e s a n d s t u r d y / l i v e r e f d i s t i n c t i

  • n

I mp

  • r

t a n t l y , w e d

  • n

’ t n e e d t

  • k

n

  • w

w h i c h e r r

  • r

s a r e n

  • n

d e t e r mi n i s t i c i n a d v a n c e . We c a n t r y t

  • u

s e a C O V R p r

  • t
  • c
  • l

t

  • r

e c

  • v

e r , a n d t h e n f a l l b a c k t

  • a

d i f f e r e n t e r r

  • r

h a n d l i n g me c h a n i s m i f t h e e r r

  • r

a p p e a r s t

  • b

e d e t e r mi n i s t i c . T h i s w i l l e l i mi n a t e n

  • n

d e t e r mi n i s t i c f a i l u r e s w h e r e a d e t e c t e d e r r

  • r

h a p p e n e d i n t h e s a me c h e c k p

  • i

n t p e r i

  • d

a s i t s n

  • n

d e t e r mi n i s t i c c a u s e . A l l r e ma i n i n g f a i l u r e s w i l l b e d e t e r mi n i s t i c

  • r

a t l e a s t e a s i l y r e p r

  • d

u c i b l e , a n d t h e r e f

  • r

e w i l l b e e a s i e r t

  • d

e b u g ! O f c

  • u

r s e t h i s me a n s t h a t

  • u

t p u t v a l i d i t y d

  • e

s n

  • t

a p p l y t

  • d

e t e r mi n i s t i c e r r

  • r

s .

slide-35
SLIDE 35

B r

  • k

e n p r

  • mi

s e s

A p r

  • m

i s e i s a r e f e r e n c e t

  • a

v a l u e t h a t n e e d n

  • t

b e a v a i l a b l e y e t . T h e p r

  • mi

s e c a n b e u s e d a s a f i r s t

  • c

l a s s v a l u e , e v e n b e f

  • r

e i t i s r e s

  • l

v e d . I t d i f f e r s f r

  • m

a l a z y r e f e r e n c e i n t h a t i t s v a l u e c a n b e r e s

  • l

v e d a s y n c h r

  • n
  • u

s l y . F

  • r

c i n g a p r

  • mi

s e c a n b e i mp l i c i t ( t y p i c a l l y b l

  • c

k i n g ) ,

  • r

e x p l i c i t ( e i t h e r b l

  • c

k i n g

  • r

n

  • n
  • b

l

  • c

k i n g ) . S

  • me

t i me s t h e c a p a b i l i t y t

  • r

e a d t h e p r

  • mi

s e ' s v a l u e a n d t h e c a p a b i l i t y t

  • r

e s

  • l

v e i t a r e s e p a r a t e d . P r

  • mi

s e s a r e b e c

  • mi

n g i n c r e a s i n g l y p

  • p

u l a r i n ma i n s t r e a m l a n g u a g e s , e s p e c i a l l y t h

  • s

e u s i n g me s s a g e p a s s i n g c

  • n

c u r r e n c y

  • r

e v e n t l

  • p

s . E r r

  • r

h a n d l i n g f

  • r

p r

  • mi

s e s i n t h e E l a n g u a g e : A p

  • s

s i b l e s t a t e f

  • r

a p r

  • mi

s e i s b r

  • k

e n

  • r

s m a s h e d . T h i s i s e s s e n t i a l l y a n e r r

  • r

v a l u e , b u t i t a v

  • i

d s s

  • me
  • f

t h e p r

  • b

l e ms

  • f

e r r

  • r

v a l u e s , b e c a u s e t h e

  • p

e r a t i

  • n
  • f

w a i t i n g f

  • r

a p r

  • mi

s e t

  • r

e s

  • l

v e i s e x p l i c i t , u s i n g a w h e n / c a t c h c

  • n

s t r u c t . Wh e n a n

  • d

e i s p a r t i t i

  • n

e d f r

  • m

a n

  • t

h e r n

  • d

e , a n y p r

  • mi

s e s i t h a s t

  • b

j e c t s

  • n

t h e i n a c c e s s i b l e n

  • d

e b e c

  • me

b r

  • k

e n . T h i s e n s u r e s t h a t w e n e v e r h a v e a c a s e w h e r e a me s s a g e i s n

  • t

r e c e i v e d , a n d t h e n a n

  • t

h e r me s s a g e w h i c h w a s a s s u me d t

  • d

e p e n d

  • n

i t i s r e c e i v e d . ( O t h e r c

  • n

d i t i

  • n

s

  • n

me s s a g e

  • r

d e r i n g , e v e n i n t h e a b s e n c e

  • f

e r r

  • r

s , a r e a l s

  • n

e c e s s a r y t

  • a

c h i e v e t h i s . ) S t u r d y r e f s a r e r e f e r e n c e s t h a t c a n s u r v i v e a p a r t i t i

  • n

. M e s s a g e s c a n n

  • t

b e s e n t d i r e c t l y t

  • s

t u r d y r e f s . A l i v e r e f c a n b e c

  • n

s t r u c t e d e x p l i c i t l y f r

  • m

a s t u r d y r e f , a l l

  • w

i n g r e c

  • v

e r y a f t e r a p a r t i t i

  • n

.

slide-36
SLIDE 36

T h a n k s

T h i s t a l k d i r e c t l y me n t i

  • n

s i d e a s a n d s y s t e ms d u e t

  • J
  • h

n B . G

  • d

e n

  • u

g h , B r i a n R a n d e l l , J i m H

  • r

n i n g , H u g h C . L a u e r , P . M i c h a e l M e l l i a r

  • S

mi t h , D a v i d H . D . Wa r r e n , M a r v i n Z e l k

  • v

i t z , E d s g e r D i j k s t r a , T a i i c h i Y u a s a , T y l e r C l

  • s

e , A l a n K a r p , M a r c S t i e g l e r , T e r e n c e K e l l y , H y

  • u

n K y u C h

  • ,

S u n g h w a n Y

  • ,

C h a r l e s K i l l i a n , S t e v e n P l i t e , J

  • e

l G a l e n s

  • n

, K e v i n R e i d , C a r l H e w i t t , a n d M a r k S . M i l l e r . S p e c i a l t h a n k s t

  • N

a t h a n Wi l c

  • x

, B r i a n Wa r n e r , A n n i e O g b

  • r

n , K e v i n R e i d , t h e L a mb d a L a d i e s , a n d t h e f r i a m g r

  • u

p f

  • r

t h e i r s u p p

  • r

t a n d e n c

  • u

r a g e me n t . T h a n k s t

  • Z
  • k
  • Wi

l c

  • x

O ’ H e a r n f

  • r

b e i n g a n a w e s

  • me

b

  • s

s a n d g i v i n g me s u f f i c i e n t t i me t

  • w
  • r

k

  • n

t h i s p r e s e n t a t i

  • n

, N

  • e

t h e r , a n d

  • t

h e r f u n s t u f f . L a s t b u t n e v e r l e a s t , t h a n k s t

  • my

p a r t n e r s A l l i e , A u r a a n d S a ma n t h a .