On Friday 14 December 2007 09:37, Felipe Monteiro de Carvalho wrote: > On Dec 13, 2007 7:55 PM, Mattias Gaertner <[EMAIL PROTECTED]> wrote: > > Has someone already created a unit for light weight threads? > > I don't know much on the subject, but Is TThread heavy? What are the > disadvantages of using it?
No, TThread is either heavy or middle-weight, according to the definitions at http://whatis.techtarget.com/definition/0,,sid9_gci814910,00.html depending on the actual implementation. On Linux 2.4 it would be heavyweight, on Win32 systems and Linux kernel 2.6+ it would be middle-weight. (Well, the context switching times mentioned there are not really up to date, usually not even context switching between processes takes several milliseconds, or "thousands of microseconds" as they liked to say.) But actually, I don't know how much more "light" a thread can take: "When all context and thread operations are exposed at the user level, each application needs only the minimal amount of context saved with it, so that context switching can be reduced to tens of microseconds. Therefore, user-level threads are considered lightweight threads." Which is something that you simply never want to do outside of bare-metal embedded systems. And even there you'd normally wrap your threading implementation in something more "middle-weight" before you expose that API to the user. Vinzent. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel