[fpc-devel] Threading support and C library under Linux/Unix

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Jun 24 13:26:08 CEST 2010


Daniƫl Mantione schrieb:

> Yes, but in a multi-cpu system giving up the timeslice is a very bad 
> idea, because the lock might be released a few clock cycles later by the 
> other cpu; you would waste the rest of time slice while you could be 
> crunching.

IMO the default implementation should work on every architecture. When 
somebody has really time critical tasks, he has to choose a decent 
architecture (machine and OS), and optimize his code for that platform.

For everydays computing background-threads are perfectly sufficient, and 
these can even be "inlined" when a platform does not provide thread 
support at all. Nobody expects that his number-crunching software will 
run on an ZX-81 as well as on a Cray, and the same IMO applies to other 
perfomance-critical requirements.

Threads IMO are the best platform-independent solution, when it comes to 
the use of the actually available resources on nowadays processors, with 
possibly more than one core. Then the OS can distribute the load on the 
available cores - and for that purpose it *must* provide the required 
synchronization features. If not, then the user did something wrong in 
the configuration of his machine, and he cannot expect that FPC gets out 
of it more than he has put in.

DoDi




More information about the fpc-devel mailing list