The repsoitory (Crio.do-demo-codes) contains the demo codes required for the Second Level Assignment Evaluation.
The assigment chosen was Multi-threading in Java.
This repository contains the following set of files along with the details mentioned:
-
ThreadTester.java - contains the java code to understand the basic creation of threads in java along with daemon condition.
-
ImplementingRunnable.java - contains the simple implementation of runnable interface to create threads.
-
RaceConditionExample.java - contains the explanatory code to have insights about the need of synchronization while working with threads.
-
Synchronization.java - contains the example which uses synchronized keyword while working with threads to help understand the need of synchronization.
-
ThreadOverheadDemo.java - conatins an example in which the calculateSumWithThreads method performs the array summation using a specified number of threads. The program measures the execution time for an optimal thread count (equal to the available CPU cores) and an excessive thread count (4 times the available cores).