sched_yield() is very slow when other threads are busy on FreeBSD-current
- From: NIIMI Satoshi <sa2c@xxxxxxxx>
- Date: Sat, 29 Sep 2007 03:42:17 +0900
Hi,
I experienced sched_yield() is very slow when other threads are busy
on FreeBSD-current.
When I run the program:
------------------------------------------------
#include <assert.h>
#include <stdio.h>
#include <pthread.h>
#define NUM_THREAD (10)
volatile int run = 0;
void *start(void *p)
{
while (!run)
;
return p;
}
int main()
{
pthread_t th[NUM_THREAD];
int i;
for (i = 0; i < NUM_THREAD; i++) {
assert(pthread_create(&th[i], NULL, start, NULL) == 0);
sched_yield();
}
run = 1;
for (i = 0; i < NUM_THREAD; i++)
assert(pthread_join(th[i], NULL) == 0);
return 0;
}
------------------------------------------------
The output of /usr/bin/time:
FreeBSD 6.2-RELEASE, libthr, HZ=100, GENERIC kernel:
0.55 real 0.55 user 0.00 sys
FreeBSD 7-CURRENT, libthr, HZ=100, kernel
include GENERIC
nooptions INVARIANTS, INVARIANT_SUPPORT, WITNESS, WITNESS_SKIPSPIN:
164.16 real 162.80 user 0.00 sys
I tried SCHED_ULE too, but does not help so much.
Increasing HZ helps to perform better, but still very slower than FreeBSD-6.
Thanks,
--
NIIMI Satoshi
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"
- Prev by Date: Re: installworld error: uuencode not found
- Next by Date: Re: installworld error: uuencode not found
- Previous by thread: installworld error: uuencode not found
- Next by thread: Automatic ZFS snapshots?
- Index(es):
Relevant Pages
- Re: Fwd: ntpd =< 4.0.99k remote buffer overflow
... will likely affect FreeBSD. ... >> * Althought it's a normal buffer
overflow, ... >>int doquery(host, ret, shellcode, align, shalign) ...
(FreeBSD-Security) - Re: C++ compile error
... > hello.C: In function `int main': ... +using namespace std; ...
> complex language when I compile my first program. ... > This post may off topic
of FreeBSD, ... (freebsd-questions) - Fwd: Re: C program to write to the com port - RESOLVED
... (under freebsd 5.4, gcc version 3.4.2) ... SerialPort.C:62: error: initializing
argument 1 of `int snprintf(char*, ... * compile with: gcc testssc.c -o testssc
... (freebsd-questions) - Re: sample buffer overflow exploit problem
... > Is there anyway I can generate shellcodes in FreeBSD? ... sample buffer
overflow exploit problem ... I'm trying to exploit sample network server in FreeBSD
5.1 ... > int handle ... (Vuln-Dev) - Re: Problem with syscall(2)
... I am attempting to write a KLD that runs under FreeBSD 6.x. ... int sz;
... pointer to a pointer of one, based on the usage in your example. ... This code
is the kernel read syscall. ... (comp.unix.programmer)