Simple Example (cont.)
Threads T1 and T2 are executing the same procedure using the same variables in and out.
Threads can be interrupted anywhere.
Race condition - the output depends on the way the threads are interleaved.
Shared variables in, out;
Procedure Echo();
read( in, keyboard );
out := in;
write( out, screen );
end Echo;
Previous slide
Next slide
Back to first slide
View graphic version