Question: C language Credit for work. Please design a multithreaded application in C with Pthreads - it determines whether the solution to a Sudoku puzzle is

C language

Credit for work.

Please design a multithreaded application in C with Pthreads - it determines whether the solution to a Sudoku puzzle is valid.

Validate two puzzles

In your program, please hard-code the following two 9x9 grids (say in two variables puzzle1 and puzzle2), and determine if each solution is valid. While each grid should be validated by multiple parallel threads, you can validate puzzle1 and then puzzle2 in sequential order (as illustrated) by a single invocation of your program. Note you are not allowed to invoke the program twice, one for each puzzle.

puzzle 1 puzzle 2

void sudoku() {

} int main() { sudoku(puzzle1); sudoku(puzzle2); return 0; }

1,8,3,5,7,6,2,4,9, 4,6,7,1,2,9,3,5,8, 9,2,5,4,3,8,7,2,6, 8,7,2,3,5,1,6,9,4, 6,9,4,7,8,2,1,3,5, 3,5,1,6,9,4,8,7,2, 5,1,9,2,6,0,4,8,7, 7,4,6,8,1,5,9,2,3, 2,3,8,9,4,7,5,6,1 5,9,6,7,1,4,3,2,8, 2,7,3,8,5,9,1,4,6, 8,1,4,2,3,6,7,5,9, 9,6,7,4,2,8,5,1,3, 1,2,5,3,9,7,6,8,4, 4,3,8,1,6,5,9,7,2, 3,5,1,6,8,2,4,9,7, 7,8,9,5,4,3,2,6,1, 6,4,2,9,7,1,8,3,5

Identifying location and reason for an invalid puzzle When a row thread/column thread/subgrid thread identifies any problem (so that the puzzle is not valid), the thread must print out the problematic row/column/puzzle location and the specific error to stdout (to be included in the screenshots). For example,

puzzle[1][2] = 3, duplicated value puzzle[4][5] = 10, not between 1 and 9 row[6], missing value 7 column[8], missing value 9

For any given problematic cell in a puzzle, your threads should generate multiple errors (identified by row thread, and/or column thread, and/or subgrid thread).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!