Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Aug 1999 11:10:54 -0500
From:      Guy Helmer <ghelmer@scl.ameslab.gov>
To:        Eric Lee Green <elgreen@iname.com>
Cc:        Geeta Mahesh <ugtech@bom3.vsnl.net.in>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Urgent ... Multithreading on freebsd...
Message-ID:  <Pine.SGI.4.10.9908061102240.12568-100000@demios.scl.ameslab.gov>
In-Reply-To: <99080608541700.00452@ehome.local.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 6 Aug 1999, Eric Lee Green wrote:

> On Fri, 06 Aug 1999, Geeta Mahesh wrote:
> > I have an application on FreeBSD 3.2 that uses posix pthreads for multithreading.
> > Though the application compiled and linked correctly, I found that no threading is taking place. 
> 
> Hi. Did you use the "-pthread" argument to gcc to tell it to use the threaded
> libc? 
> 
> > The whole application runs as a single thread even though I have created threads using the pthread api
> > pthread_create(). I also checked with the ps command and found that no thread is getting created. 
> 
> I'm not sure that pthreads under BSD will show up under "ps". Someone more
> familiar with FreeBSD will have to enlighten us there. 

The pthreads implementation under FreeBSD is currently executes only in
user space, giving an M:1 ("M" user-space threads to 1 kernel-space
thread) implementation.  The kernel provides a single thread of execution
so only a single process shows up when you execute "ps".

However, FreeBSD's kernel does support Linux's kernel-based implementation
of threads, which gives 1:1 (1 user-space thread maps to 1 kernel-space
thread) and each thread appears as another process in "ps".  I've built
multithreaded apps under Linux and then executed the Linux binaries under
FreeBSD to take advantage of SMP :-)

Guy

Guy Helmer, Ph.D. Candidate, Iowa State University Dept. of Computer Science 
Research Assistant, Ames Laboratory       ---         ghelmer@scl.ameslab.gov
Research Assistant, Dept. of Computer Science   ---   ghelmer@cs.iastate.edu
http://www.cs.iastate.edu/~ghelmer



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.4.10.9908061102240.12568-100000>