I am allowing quite a bit of time to complete this assignment because a few students may not be familiar with Java. Assignment #5, which will also be a Java threads program, will likely overlap with this assignment.
Design and implement "two" Java application programs with the following characteristics. Each program must:
All the worker threads will likely execute the same "code" but will
work on different data. You should implement the code for a thread
using the Runnable
interface.
The "waiting" may be carried out any way you want. The simplest way would be to go into a busy-waiting loop, alternately sleeping and checking whether any threads remain active. Alternatively, you may do some more explicit synchronization using semaphores, monitors, etc.
Be sure that your program does not have a race condition. For example, you may want to use various sleep periods in your busy-waiting loop.
The "two" programs will, of course, be very similar. Try to arrange it so that you can do either task with the same crew chief program.
This task is to compute the product of two matrices.
Each worker subtask should be to multiply a row of the first matrix by the entire second matrix to generate a result a row of the product matrix.
This task is to search several URLs on the World Wide Web to determine the total number of occurrences of a given string in the set of URLs. (You may assume the string does not span across lines of text.)
Each worker subtask is to search one URL for a given string. (The searches should, of course, be done concurrently.) You may want to examine the file URLSearcherTest.java on the anonymous ftp site for an example of how to access URLs from java. (Warning: The URLSearcherTest program is not documented and has not been fully tested.)
Submit a paper copy of your program listing and testing output to your instructor by the due date. Make sure you have documented your program appropriately and tested your program thoroughly.
Also submit copies of your source code via email to en664@hal.cs.olemiss.edu.
UP to the ENGR 664 Assignments document?