Concurrent Prime Number Test Model Documents

Main Document

The Concurrent Prime Number Test Model uses the trial division algorithm to decide if a number is prime. The prime division algorithm is inefficient and we use it here only to test the EJS implementation of the Parallel Region Element in EJS. A parallel region executes independent code in threads that execute simultaneously on a multi-core processor. The screen capture shows that the total execution time for four computations on a quad-core processor is only one millisecond longer than the execution time for the longest single computation. This linear speedup is close to the theoretical maximum.

The Concurrent Prime Number Test Model was created using the Easy Java Simulations (EJS) modeling tool. It is distributed as a ready-to-run (compiled) Java archive. Double clicking the model's jar file will run the simulation if Java is installed.

Supplemental Documents

The Sequential Prime Number Test model uses the prime division algorithm to decide if a number is prime. The model records the computational time in milliseconds required to test each number and total computational time. The model shows that the total computational time is approximately equal to the sum of the individual times because the tests are performed sequentially.