Monday, 22 January 2007

pthread on slackware on vmware on windows xp

Yesterday, I had to write a multithreaded application using posix threads on linux, for one of my friends.
We had thought that we could do it by installing slackware linux on a vmware virtual machine running on windows xp. brillant idea, huh?
For early 4 hours, everything was ok. We drawn up state diagrams and wrote trivial code parts to use later.
After that, we set up threading and thread syncronisation using mutexes. Then the nightmare started. Results were inconsistent. Sometimes things went well, and sometimes deadlocks occured.
We could not obviate managing of the conditional variables (pthreads mutexes), and worked different solutions, algorithms for about 4 hours. It was suspicious that Sleep(int) method worked seconds-based, not miliseconds-based as expected on a linux. and bigger values like sleep(1000) did not cause a sleep.
We renounced at late of the evening.
The day after, we requested one of our friends to try the same source on his native linux (pardus).
And a dramatic notice! It had given the expected(correct) results.
We think it is vmware. But already so many multithreaded applications work on it. Is it posix threads library version on slackware? We don't know yet.

1 comment:

Ronan Klyne said...

Sorry to hear about your woes... Did you get any further with this problem?
I'm experiencing something that looks very similar but is not easily reproduceable...