Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Nov 2005 21:01:32 -0500
From:      Nicolas Blais <nb_root@videotron.ca>
To:        freebsd-threads@freebsd.org
Subject:   1 process, 2 threads, how many cpus?
Message-ID:  <200511272101.38903.nb_root@videotron.ca>

next in thread | raw e-mail | index | archive | help
--nextPart1494872.MxKkvnvTrC
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

As I was looking around the net for some information on pthreading in FreeB=
SD,=20
I came across something that got my attention:

"The native user threads cannot concurrently run more than one thread on=20
separate processors at one time. If you are running a single process with=20
multiple CPU-intensive threads in hopes of utilizing multiple processors, y=
ou=20
must use Linuxthreads to get this performance."
(http://www.unobvious.com/bsd/freebsd-threads.html)

Is this still applicable now (FreeBSD 5.4/6/CURRENT)?=20

I'm writing a software that runs 1 process and multiple threads (with pthre=
ad)=20
that performs calculations and I was wondering if on a SMP system the threa=
ds=20
will run on an independant cpu.  It would be quite pointless to have all=20
threads of the same process sharing a single cpu.

Also, no matter how many threads I create within a process, 'top' only repo=
rts=20
2 threads.  The following 'top' run reports my software ('aite') as using 2=
=20
threads (when it actually created 4):

CPU states: 99.2% user,  0.0% nice,  0.8% system,  0.0% interrupt,  0.0% id=
le
Mem: 257M Active, 1422M Inact, 189M Wired, 85M Cache, 112M Buf, 49M Free
Swap: 2000M Total, 2000M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
89728 nicblais    2  20    0  4420K  2384K ksesig   0:18 77.44% aite

Any insight appreciated,
Nicolas.

=2D-=20
=46reeBSD 7.0-CURRENT #2: Sat Nov 26 10:55:30 EST 2005    =20
nicblais@clk01a:/usr/obj/usr/src/sys/CLK01A=20
PGP? (updated 16 Nov 05) : http://www.clkroot.net/security/nb_root.asc

--nextPart1494872.MxKkvnvTrC
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQBDimUC4wTBlvcsbJURAlP0AKCUuZJ7/+tqZrCfS9eaJu+jVkAmeQCfYf/r
kgOWgxV8yIktXm3YxYwAIas=
=z+ia
-----END PGP SIGNATURE-----

--nextPart1494872.MxKkvnvTrC--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511272101.38903.nb_root>