For this Project 3 Threads milestone, your project must maintain the functionality from the Project 2 Search assignment, as well as support multithreaded building of the inverted index using a custom-made conditional read/write lock to create a thread-safe inverted index and a custom-made work queue to manage worker threads.
To do this, you should either create new classes or extend existing classes to support multithreading. DO NOT REMOVE YOUR SINGLE THREADING CODE, as you still need to support single threaded building and searching the index.
<aside>
<img src="/icons/error_gray.svg" alt="/icons/error_gray.svg" width="40px" /> Do NOT use any of the classes in the java.util.concurrent
package and do NOT use the Stream.parallel
method for the multithreaded code.
</aside>
TABLE OF CONTENTS
You must complete the following assignments before beginning to work on this one:
Your main
method must be placed in a class named Driver
and must process the following additional command-line arguments:
-threads [num]
where the flag -threads
enables multithreading and indicates the next optional argument [num]
is the number of worker threads to use in the work queue. If the [num]
argument is not provided, not a number, or less than 1
, use 5
as the default number of worker threads.
For all v3.0
releases of this project, only the build process must be multithreaded. See the “Multithreaded Building” section below for details.
These are in addition to the command-line arguments from the previous Project 2 Search assignment.
The command-line flag/value pairs may be provided in any order or not at all. Do not convert paths to absolute form when processing command-line input!
Output user-friendly error messages in the case of exceptions or invalid input. Under no circumstance should your main()
method output a stack trace to the user!
<aside>
<img src="/icons/warning_gray.svg" alt="/icons/warning_gray.svg" width="40px" /> If the -threads
flag is not provided, then multithreading should not be enabled. A thread-safe inverted index should not be initialized, a work queue should not be initialized, no worker threads should be created, and the pr
</aside>
If multithreading is enabled, the build process from Project 1 Index must be multithreaded as follows:
main
method exits. See the PrimeFinder homework for how to create this work queue.