Multiple threads vs Multiple processes
I recently covered multi-threading in my Information Engineering course and I was wondering something.
fork() as I know it, creates a new process and hence isn't really "multithreading". And according to my lecturer, swapping processes within the CPU takes much longer than swapping threads. So, what function do you call to create a new thread for the same process? Also, with regards to a Beowulf cluster. Since only specific clustering software can run on a beowulf cluster, does it require special programming? Or will a multi-threaded program work? I'm asking this because I am planning to build a Beowulf cluster in the future and would like to "future-proof" my current programs. Thank you for your time. |
Hi,
You can use the pthreads library. The function to create a new thread is: Code:
#include <pthread.h> |
All times are GMT -5. The time now is 05:51 PM. |