Why I used simple arithmetic to study concurrency
I chose matrix addition for this reference because the arithmetic is easy to state: each output cell adds the two input cells at the same coordinate. That let me focus the walkthrough on the harder contract around ownership, validation, task completion, and failure propagation.
The submission record is dated July 19, 2022, but the final implementation archive was not recovered. In October 2026, I built the Java demonstration described here: I defined its file format, validated matrix shapes, divided writes by row, and joined worker results while keeping arithmetic failures visible.
How I narrowed the input contract
I accept two nonempty, rectangular integer matrices with identical shapes. Before any arithmetic, I reject null matrices, null rows, ragged rows, and unequal dimensions. I validate both complete shapes because checking only the first row could let a malformed later row fail partway through the operation.
For the reconstructed console, I defined a format with row and column counts, then every value of A followed by every value of B in row-major order. I use this small example:
2 2
1 2
3 4
5 6
7 8I can calculate its expected sum independently:
6 8
10 12I identify that format as a new documented choice, not a recovered historical interface. I limit each console dimension to 1,000 and reject extra tokens as well as truncated input. These limits bound my demonstration; they are not inherent limits of matrix addition.
Why I established the serial result first
I first allocate a fresh result with the validated dimensions and visit every row and column to add matching values. Because ordinary Java integer addition can wrap silently, I use Math.addExact in the reference:
result[row][column] = Math.addExact(
left[row][column], right[row][column]);That gives me a clear contract: return the mathematical sum if it fits in an int, or produce an explicit arithmetic failure. Integer.MAX_VALUE plus 1 must fail instead of returning a plausible-looking negative number.
I retain the fixed 2×2 expected answer even when the serial and parallel methods share a row helper. Shared code can produce identical wrong answers, so a separately calculated result gives my comparisons an independent anchor.
How I assigned each worker its own row
I create a bounded ExecutorService and submit one task for each result row. Every task reads A and B, but task r writes only result row r. Because no workers share a destination cell, I do not need a lock around the arithmetic.
I also make the caller's obligation explicit: the inputs must not change while workers read them. A private result does not make shared input arrays immutable. I could instead copy inputs before submission, but this reconstruction uses the stated ownership contract.
I chose one task per row because it is straightforward to inspect and test, not because I had measured it as the fastest partition. A tall matrix creates many tasks, while a short, wide matrix offers little row-level parallelism. I leave those as performance questions for later measurement.
The challenge: joining results without hiding failure
How I make a parallel sum complete or fail

For my new 2026 reference, I check both number grids completely before adding any values. I require nonempty grids with equal row and column counts, and reject missing grids, missing rows, or rows with different widths. Checking every row lets me identify a malformed input before calculating part of an answer.
Read all step descriptions
- Validate both shapes
For my new 2026 reference, I check both number grids completely before adding any values. I require nonempty grids with equal row and column counts, and reject missing grids, missing rows, or rows with different widths. Checking every row lets me identify a malformed input before calculating part of an answer.
- Assign rows
In my 2026 design, each worker reads both input grids and writes to its own row in a separate result grid. Keeping their writes apart avoids having to coordinate access around every addition. I require the caller to leave the shared inputs unchanged while the workers run, because creating a separate output does not prevent changes to the inputs.
- Check each addition
I use Java’s Math.addExact operation for every cell so a sum outside the integer range causes an explicit failure. This prevents an oversized number from wrapping around and appearing to be a valid answer. I also compare a two-by-two example with hand-calculated results, because the single-worker and multiple-worker versions could otherwise share the same mistake.
- Join the futures
I keep a future for each worker—a handle that lets me wait for its result—and wait on every one before returning the grid. Starting a task alone does not tell me that its row is finished. If a worker’s sum exceeds the integer range, I pass the underlying arithmetic failure back to the caller rather than returning a mixture of completed and untouched cells.
- Release the pool
I put shutdown of the worker pool, the threads used to carry out the additions, in a finally block that runs after success or failure. Waiting for workers establishes whether the rows finished, while this cleanup closes the pool after either outcome. This is part of my 2026 reference design, and the recorded checks assess behavior without measuring a speed advantage from parallel work.
The concurrency constraint I needed to work through was that submitting work does not establish completion. I retain every future and call Future.get before returning the output, so callers cannot observe a partly calculated answer.
I also needed worker failures to cross that join. An arithmetic exception arrives through ExecutionException, so the implementation unwraps it to keep overflow visible as the underlying problem. My response to a failed worker is an explicit failure, not a returned matrix mixing calculated and untouched cells.
I shut the pool down in a finally block so normal and exceptional paths both release the executor. I keep that lifecycle responsibility distinct from joining: waiting establishes successful completion, while cleanup prevents a failed invocation from leaving its pool unmanaged.
How I compared shapes and worker counts
I used deterministic generated inputs with four row counts, three column counts, and three worker counts, giving 36 serial/parallel comparisons. For each case, I compare dimensions and every cell; an aggregate sum could hide values written in the wrong places.
I also check malformed shapes, the known 2×2 answer, and overflow inside a worker. The failure-boundary test puts an overflowing pair in a task's row and confirms that the parallel call fails rather than returning normally.
The October 2026 record reports that all 36 comparisons and the targeted checks passed. I use those results as evidence of agreement and the tested validation behavior for this implementation. They do not measure throughput or prove a speedup.
What I learned before making any speed claim
I did not perform a speed benchmark during the restoration. For small inputs, task creation and coordination may cost more than the additions. Before making a credible speed comparison, I would need to state the runtime, warmup strategy, input sizes, repeat count, timing boundary, and whether executor startup is included.
My result is deliberately bounded: integer arrays, checked arithmetic, shared read-only inputs, separate output rows, and a join that preserves failures. There is no sparse representation, GPU path, or distributed execution. I learned to make the concurrency contract inspectable before discussing speed, while keeping these contemporary design choices separate from the missing 2022 program.
Original final archive missing. Java language choice, input format, architecture, code, and tests are a new October 2026 reconstruction; 36 deterministic comparisons are correctness observations, not speed measurements.
Validation & limitations
- Original final archive missing. Java language choice, input format, architecture, code, and tests are a new October 2026 reconstruction; 36 deterministic comparisons are correctness observations, not speed measurements.
Project records
- Project artifacts and historical records, July 19, 2022 submission evidence
- Restoration and public documentation, October 1, 2026
