Name: _____________________________ 6 Digit StudentID: ___ ___ ___ ___ ___ ___

Worksheet 27: Omega

Encircle lines data race lines and implement a race free version below.

public static double dataRaceHypotenuse(double a, double b) {
    Lock lock = new ReentrantLock();
    double[] sum = {0.0};
    Future<Void> future = void_fork(() -> {
        lock.lock();
        try {
            sum[0] += a * a;
        } finally {
            lock.unlock();
        }
    });
    sum[0] += b * b;
    join(future);
    return Math.sqrt(sum[0]);
} 
public static double dataRaceFreeHypotenuse(double a, double b)

Bonus Puzzle

17 Prefix with chloride
19 Movie rating rating indicating some material may not be suitable for children: Abbr.
21 Poker prize
22 The blahs
24 PC "oops" key
25 The Grapes of Wrath: "____ settled on the floors, and only mouse and weasel and cat tracks disturbed it" (2 words)
26 Arson aftermath
27 Algebra or trig
DOWN
1 15-Down followed by 13-Across
2 Hellenic h
3 20-Down command to create a snapshot of the 5-Downs
4 Patella's place
5 20-Down command to add files
6 Facility
7 Visible part of an iceberg
8 Department of Justice div.
14 Country with a Hutu majority
15 See 1-Down
17 Easy throw
18 500 sheets
19 20-Down command to transmit the 3-Downs to the remote
20 Linus Torvalds creation which he dubbed "the stupid content tracker".
21 Unimpressive brain size
23 Cashew, e.g.
ACROSS
1 Quantity of pickled peppers Peter Piper picked
5 Collection of different elements
8 Fold-up mattress
9 ___ chi
10 20-Down command to show who made recent modifications
11 Agent of Cleopatra's demise
12 Land of Lincoln St.
13 See 1-Down
15 Wi follower
16 ____ belong

Post Lecture

Synthesize today's class session

 

 

What is unclear?