From owner-freebsd-questions Fri Aug 6 9:11:54 1999 Delivered-To: freebsd-questions@freebsd.org Received: from mailhub.scl.ameslab.gov (mailhub.scl.ameslab.gov [147.155.137.127]) by hub.freebsd.org (Postfix) with ESMTP id 9C9CE14D24 for ; Fri, 6 Aug 1999 09:11:45 -0700 (PDT) (envelope-from ghelmer@scl.ameslab.gov) Received: from demios.ether.scl.ameslab.gov ([147.155.137.54]) by mailhub.scl.ameslab.gov with esmtp (Exim 3.02 #1) id 11Cma6-000HTL-00; Fri, 06 Aug 1999 11:10:54 -0500 Date: Fri, 6 Aug 1999 11:10:54 -0500 From: Guy Helmer To: Eric Lee Green Cc: Geeta Mahesh , freebsd-questions@FreeBSD.ORG Subject: Re: Urgent ... Multithreading on freebsd... In-Reply-To: <99080608541700.00452@ehome.local.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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