The random driver story isn't over yet, it seems. The many

thread_yield() calls make reseed() really slow in a busy system, since
another thread will exhausts its full quantum between two thread_yield()
calls. And 257 * 8 * 8 quanta are about 49s.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24375 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-03-12 20:36:19 +00:00
parent 2edcae687e
commit a2ca07f4ec
@@ -191,8 +191,17 @@ reseed(ch_randgen *prandgen, const uint32 initTimes)
for (j = initTimes; j; j--) {
for (i = NK * initTimes; i; i--) {
// TODO: Yielding sounds all nice in principle, but this will take
// ages (at least initTimes * initTimes * NK * quantum, i.e. ca. 49s
// for initTimes == 8) in a busy system. Since perl initializes its
// random seed on startup by reading from /dev/urandom, perl
// programs are all but unusable when at least one other thread
// hogs the CPU.
thread_yield(false);
// TODO: Introduce a clock_counter() function that directly returns
// the value of the hardware clock counter. This will be cheaper
// and will yield more randomness.
y.Q[0] += system_time();
attach(&x, &y, 0x52437EFFU, 0x026A4CEBU, 0xD9E66AC9U, 0x56E5A975U);
attach(&y, &x, 0xC70B8B41U, 0x9126B036U, 0x36CC6FDBU, 0x31D477F7U);