Hello, I'm trying to make a program that will multiply 2 matrices using shmget() and fork(). For example, I would need to multiply a 64 x 64 matrix using 4 processes or 16 processes, and the multi-processes will be created using fork. Each process will calculate a partition of the final Matrix
Now, I'm not sure whether I should write all the matrices to the shared memory or just a single integer to keep track of what partition to calculate....
User Profile
Collapse
-
Need some help with shared memory and fork system call
-
Thanks for the quick help. I changed my code quite a bit since yesterday. However I now get a "invalid conversion from `void*' to `__pthread_t**" on line 63 of my code. Here is the updated code:
Code:#include <pthread.h> #include <stdlib.h> #include <stdio.h> #define SIZE 10 /* Size of matrices */ int N; /* number of threads */ int A[SIZE][SIZE], B[SIZE][SIZE],
-
Matrix Multiplication using multi-threads gets segmentation fault
Hello, I'm trying to write a program that calculates up to a 1024 x 1024 matrix using multi-threading. For example, I need to run a 1024 x 1024 using 256, 64, 16 or 4 threads. Or I need to run a 64 x 64 matrix using 16 or 4 threads. All the Matrices are square. I thought I coded my program correctly, however I get a segmentation fault when I use a 720 x 720 matrix or higher, heres the code.
Code:#include <iostream> #include
No activity results to display
Show More
Leave a comment: