Question: A Sudoku puzzle uses a 9 9 grid in which each column and row, as well as each of the nine 3 3

A Sudoku puzzle uses a 9 × 9 grid in which each column and row, as well as each of the nine 3 × 3 subgrids, must contain all of the digits 1 to 9.

This project consists of designing a multithreaded application that determines whether the solution to a Sudoku puzzle is valid.

There are several different ways of multithreading this application.

The suggested strategy is to create threads that check the following criteria:

• A thread to check that each column contains the digits 1 through 9

• A thread to check that each row contains the digits 1 through 9

• Nine threads to check that each of the 3 × 3 subgrids contains the digits 1 through 9

This would result in a total of eleven separate threads for validating a Sudoku puzzle. However, you are welcome to create even more threads for this project. For example, rather than creating one thread that checks all nine columns, you could create nine separate threads and have each of them check one column.

Passing Parameters to Each Thread

The parent thread will create the worker threads, passing each worker the location that it must check in the Sudoku grid. This step will require passing several parameters to each thread.

Returning Results to the Parent Thread

Each worker thread is assigned the task of determining the validity of a particular region of the Sudoku puzzle.

Once a worker has performed this check, it must pass its results back to the parent.

One good way to handle this is to create an array of integer values that is visible to each thread.

The I the index in this array corresponds to i the worker thread.

If a worker sets its corresponding value to 1, it is indicating that its region of the Sudoku puzzle is valid.

A value of 0 would indicate otherwise.

When all worker threads have completed, the parent thread checks each entry in the result array to determine if the Sudoku puzzle is valid.

Step by Step Solution

3.28 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Total answers posted by the expert is 5509 SOLUTION I have solve the probl... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!