Open AlexOreshkevich opened 3 years ago
Calculate average number of some large amount of numbers, like 10E9.
Create several threads and distribute the total amount among them. Play with priorities and length of distributions.
Calculate partial sums and store them into the shared object or variable. Use volatile, synchronized or whatever appropriate.
volatile
synchronized
Create unit test and compare performance of calculation and correctness with usual implementation using for cycle. Use https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html#average-- to demonstrate correctness of your calculations.
Optional: use https://www.baeldung.com/java-microbenchmark-harness for benchmarking
Calculate average number of some large amount of numbers, like 10E9.
Create several threads and distribute the total amount among them. Play with priorities and length of distributions.
Calculate partial sums and store them into the shared object or variable. Use
volatile
,synchronized
or whatever appropriate.Create unit test and compare performance of calculation and correctness with usual implementation using for cycle. Use https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html#average-- to demonstrate correctness of your calculations.
Optional: use https://www.baeldung.com/java-microbenchmark-harness for benchmarking