Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-10

threading on posix platform

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bee

Hi all,

Are there any specific things that need to be concerned regarding threading on posix platform (linux, mac, etc)? Especially their differences with windows platform.

I'm now experimenting with ExtPascal. It works fine on windows but it got some problems on posix platforms. Sometimes I just don't understand why it didn't work. :(

Are there any references out there describing about this topic in details? TIA.

-Bee-

Graeme Geldenhuys
to Bee
Bee wrote
Are there any specific things that need to be concerned regarding threading on posix platform (linux, mac, etc)? Especially their differences with windows platform.

Under Linux the thread scheduler works quite different to Windows. For example: I ported the Thread Sort demo from Delphi 7 to Lazarus, so I could run it under Linux. Under Linux, the three sort threads run in sequence, where as under Windows, they run in parallel.

In the end (with a few posts to the mailing list), we found out that if a task (thread) is quick or not very CPU intensive, Linux prefers to give them longer timeslices instead of constantly switching threads. That was the only thing I noticed, but other than that, I use threads (although little at the moment) in exactly the same way as I did with Delphi and all is fine.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Bee
to Graeme Geldenhuys
Show quoted text 6 lines
In the end (with a few posts to the mailing list), we found out that if a task (thread) is quick or not very CPU intensive, Linux prefers to give them longer timeslices instead of constantly switching threads. That was the only thing I noticed, but other than that, I use threads (although little at the moment) in exactly the same way as I did with Delphi and all is fine.

It might be the case, I'm not sure. In my case, sometimes my app (fcgi) couldn't create a new requested thread, but at other times it created successfully. It happened randomly which gave me enough headaches to find what caused the problem. Such case didn't happen on windows.

Anyway, thanks for the tips, Graeme.

-Bee-