Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

d Use this code: #include #include #include /* You will need a structure to store the information to be passed to each thread (see Passing

image text in transcribeddimage text in transcribed

Use this code:

#include

#include

#include

/* You will need a structure to store the information to be passed to each thread (see "Passing Parameters to Each Thread" in the textbool's project description)*/

/* Declare the thread that checks columns */

void *column_worker(void *param); // the function parameter is for the structure you defined

/* You will also need to declare threads that checks rows and 3x3 subgrids */

/* You will need to declare an array of integer values that is visible to each thread. The value in the array (0 or 1) indicates whether the worker thread's number is valid (see "Returning Results to the Parent Thread" in the textbook's project description) */

int main(int argc, char *argv[])

{

/*You need to assign values to the structure variable. Then you can create multiple worker threads by passing the information using the structure variable*/

/*You need to call pthread_join() for each childer thread so that the parent will wait*/

/* Finally, after all children returns, you can check the status array that is visible to everyone and see if it is valid. You then print out the final checking result*/

return 0;

}

/*thread code for child checking all columns*/

void *column_worker(void *params)

{

pthread_exit(0);

}

/* also need to define threads for checking rows and 3x3 subgrids */

Design and implement a Sudoku Solution Validator using Pthreads library in Linux virtual machine Steps: Download the incomplete version of hw2.c from iCollege Read through Programming Project 1 of Chapter 4 in the textbook. Follow the suggestion in the textbook to complete the C program in order to check Sudoku puzzle using 11 children threads. In addition, you program should meet the following requirement The 9x9 data grid to be tested are stored in two txt files, grid1 and grid2, which can be downloaded from iCollege The name of the txt file will be the input to the program via command line, i.e., you can access the name of this file through argv[1] in your main() function. Then you can open the file and read the data grid from the file. The output message stating whether or not the tested grid is a Sudoku puzzle should be finally printed to the screen. o o o Compile the C source file using gcc-pthread -o hw2 hw2.c .Use./hw2 grid1 to test the first data grid and ./hw2 grid2 to test the second data grid Take a screenshot of the program output after you tested the two data grids Design and implement a Sudoku Solution Validator using Pthreads library in Linux virtual machine Steps: Download the incomplete version of hw2.c from iCollege Read through Programming Project 1 of Chapter 4 in the textbook. Follow the suggestion in the textbook to complete the C program in order to check Sudoku puzzle using 11 children threads. In addition, you program should meet the following requirement The 9x9 data grid to be tested are stored in two txt files, grid1 and grid2, which can be downloaded from iCollege The name of the txt file will be the input to the program via command line, i.e., you can access the name of this file through argv[1] in your main() function. Then you can open the file and read the data grid from the file. The output message stating whether or not the tested grid is a Sudoku puzzle should be finally printed to the screen. o o o Compile the C source file using gcc-pthread -o hw2 hw2.c .Use./hw2 grid1 to test the first data grid and ./hw2 grid2 to test the second data grid Take a screenshot of the program output after you tested the two data grids

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Describe legally required benefits.

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago