Question
Design a multithreaded Sudoku Solution Checker program that accepts a Sudoku solution from the user as input, and determines whether the solution is valid or
Design a multithreaded Sudoku Solution Checker program that accepts a Sudoku solution from the user as input, and determines whether the solution is valid or invalid.
The program accepts a Sudoku solution from a file.
Make threads that:
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 1through 9
Can someone explain to me the best way to appraoch this? We are writing the assignment in C. I am wondering if I should convert the file to a 2d array first then send data to the threads? I am confused on how the data is being transferred in the above example?
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. The easiest approach is to create a data structure using a struct. For example, a structure to pass the row and column where a thread must begin validating would appear as follows: /* structure for passing data to threads */ typedef struct int row; int column; l parameters; Both Pthreads and Windows programs will create worker threads using a strategy similar to that shown below parameters *data = (parameters *) malloc (sizeof (parameters)); data->row-1; data->column1; /* Now create the thread passing it data as a parameter */ The data pointer will be passed to either the pthread create0 (Pthreads) function or the CreateThread0 (Windows) function, which in turn will pass it as a parameter to the function that is to run as a separate threadStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started