Date: Sun, 16 Nov 2008 22:36:25 +0300 From: "Peter Dreight" <dreigcht@gmail.com> To: freebsd-threads@freebsd.org Subject: threads hang with xorg running Message-ID: <fc16cd0b0811161136r2b33724r88407c8f4534917b@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
The following program runs perfectly on FreeBSD 6.3 amd64 (with xorg running and without xorg running). But on FreeBSD 7.0 amd64 and 7.1 beta amd64 (only with xorg running - xterm - konsole - etc) after a few seconds of working the thread "period_thread" hangs printing only one time a second and even less. Moreover, the whole system becomes slow though "top" does not show a heavy load. Tried on Intel E6600 and on Intel E1200 with the same result. Tried with GENERIC kernel "out of the box" and with my kernel configurations with the same result. Tried with 4BSD and ULE schedulers with the same result. #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <unistd.h> void* heavy_thread(void* q) { const size_t SIZE = 500; volatile double vec[SIZE]; size_t cnt; for(cnt = 0; cnt < 1000000; ++cnt) { size_t i; for(i = 0; i < SIZE; ++i) { vec[i] = 0; } for(i = 0; i < SIZE; ++i) { vec[i] += i; vec[i] -= i; } } } void* period_thread(void* q) { int i; for(i = 0;;++i) { printf("period thread %i\n", i); usleep( 50 * 1000 ); } } int main( int argc, char** argv ) { pthread_t hs; pthread_create(&hs, NULL, period_thread, NULL); for(;;) { const size_t SIZE = 5; pthread_t h[SIZE]; size_t i; for(i = 0; i < SIZE; ++i) { pthread_create( &h[i], NULL, heavy_thread, NULL); } for(i = 0; i < SIZE; ++i) { pthread_join(h[i], NULL); } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fc16cd0b0811161136r2b33724r88407c8f4534917b>