Matrix multiplication using threads

Can someone suggest me how to do multiplication of two matrix using thread? The thread handling can't be done using pthread.h or any other available libraries. It has to be done using system calls. So please give me some suggestion how should I start?

Thanks.
Write a function which takes your two matrix as a parameter, just keep in mind that you can accept only one parameter to this function (if you want to use pthreads as thread function takes only one parameter). Calculate matrix multiplication in this function. Keep in mind that you don't have to take any static, global variable in this function as this function will be used simultaneously by your threads. When you think that the function is working fine, make it a thread function.

Now you can use pthreads to make it a thread function. But as you don't want to use pthread, use fork. Lets say you want to do the multiplication five times, so call fork() five times and in the child process, call this function which is calculating matrix multiplication.

In the parent, wait for all fork() command otherwise the child are going to be zombie or defunct process's.

read about fork() for usage.

You can use clone also as pthread_create uses clone internally.
Last edited on
pthreads is the way you use threads, unless your particular OS has some more basic primitives that you're expected to use.
Topic archived. No new replies allowed.