2015-02-25 22:47 GMT+08:00 Dmitry Boyarintsev <skalogryz.li...@gmail.com>:
> I presume most of the systems would make the sleeping thread to yield the > execution time for other threads. > The questionable behavior might occur in case of sleep(0); (should it > yield the remaining time or just return immediately - up to the OS). > And multi-cpu might also do something different. > > Yes, I am particularly interested in behavior of SMP system. i.e. my purpose of using threads is to take full advantages of all CPU cores. As far as I know, setting thread priority does not always work, it may require root privilege for example. I would like to use Sleep() to control relative time share of all threads in the pool. For example, I run 3 threads on a dual-core system, with thread 1 and 2 share core-1, and thread 3 taking all computing power of core-2... Now the problem is, can I use Sleep to control thread 1 to run at 50% of the speed of thread 2 (which is not throttled), providing that all threads are doing same kind of task, so that they are comparable? Xiangrong
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal