threading on posix platform

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

threading on posix platform

Bee-6
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-
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: threading on posix platform

Graeme Geldenhuys-2
On Mon, Oct 20, 2008 at 7:22 AM, Bee <[hidden email]> 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/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: threading on posix platform

Bee-6
> 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-

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: threading on posix platform

Vinzent Höfler
Bee wrote:

> 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.

http://bugs.freepascal.org/view.php?id=10815
http://bugs.freepascal.org/view.php?id=6693


HTH,

Vinzent.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal