- This program runs 10 threads that concurrently process an infinite stream of random characters in search of the string
"FiCo"
. - The program accepts a
TIMELIMIT
argument which is used to limit the amount of time the aforementioned threads conduct their search. - If no
TIMELIMIT
argument 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
SUCCESS
indicates the thread succesfully discovered"FiCo"
within the time limit. - The status
TIMEOUT
indicates the thread could not discover"FiCo"
within the time limit. - The status
FAILURE
indicates 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
./hatch
directory. - 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 -h
to recieve a list of commands and what they do.
- The
.java
files can be found in the./hatch/src/com/hatchcard/prabhath
directory. - The
.class
files can be found in the./hatch/bin/com/hatchcard/prabhath
directory. - The
Boss
class is the main class and entry point of the program, it spawns eachWorker
. - The
Worker
class creates an infinite stream of random characters (usingDataStreamUtils
) and iterates through each character in the stream using aCustomForEach
iterator.