/* THREAD POOL IMPLEMENTATION ASSIGNMENT The assignment to implement thread pools has already been well explained in the lectures. You MUST implement the following interface: */ public interface threadpool { // Called when user submits a job to the pool. submit assigns a "job id" // integer to your submitted job and returns that id. You will need this // id when calling the other functions in this interface. // Any instance of a class that implements Runnable can be submitted: int submit(Runnable job); // Called by user, which will suspend the calling thread until the job // identified by the jobid has been performed (gives up monitor) void jjoin(int jobid); // Called by user, returns when all submitted jobs have been completed, // also suspends calling thread. void joinall(); // Called by user, returns one of the following values: // -1: invalid job id // 0: job is still WAITING to be executed // 1: job is currently RUNNING (being executed) // 2: execution of the job has COMPLETED. // This function is non-blocking (returns immediately): int getstatus(int jobid); } /* Run your program with at least the sample programs (including matrix multiplication) that I've posted. Additional hint: if you use an arraylist to keep track of submitted jobs, You should probably use some other index variable to allow you to find waiting jobs more efficiently. In the sample producer-consumer program I showed you, you had to start searching for a new product from the beginning of the list. This is somewhat inefficient. Of course, you can also choose a more sophisticated data structure in place of an ArrayList, such as a priority heap. */