- This program runs 10 threads that concurrently process an infinite stream of random characters in search of the string
"FiCo". - The program accepts a
TIMELIMITargument which is used to limit the amount of time the aforementioned threads conduct their search. - If no
TIMELIMITargument is specified, it defaults to 60000 milliseconds (1 minute).
- This program outputs a single line of information per thread created. It also outputs one final line that analyzes performance.
- Each thread's output is printed in one of the following formats:
[ELAPSED_TIME, TOTAL_BYTES_READ, STATUS]or[STATUS] - The output is in descending order by
ELAPSED_TIME. - The status
SUCCESSindicates the thread succesfully discovered"FiCo"within the time limit. - The status
TIMEOUTindicates the thread could not discover"FiCo"within the time limit. - The status
FAILUREindicates the thread could not execute properly. Error messages are sent tostderr. - The final line of output indicates amount of bytes read per millisecond.
- After extracting contents of hatch.zip, open a shell and navigate into the
./hatchdirectory. - This is a Java program and requires JDK 8 or later, so install it first. Ubuntu users may use the following command:
sudo apt-get install default-jdk - Use
$ bash prabhath.sh -hto recieve a list of commands and what they do.
- The
.javafiles can be found in the./hatch/src/com/hatchcard/prabhathdirectory. - The
.classfiles can be found in the./hatch/bin/com/hatchcard/prabhathdirectory. - The
Bossclass is the main class and entry point of the program, it spawns eachWorker. - The
Workerclass creates an infinite stream of random characters (usingDataStreamUtils) and iterates through each character in the stream using aCustomForEachiterator.