From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 30 23:50:55 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43BBD16A406 for ; Tue, 30 Jan 2007 23:50:55 +0000 (UTC) (envelope-from John.Giacomoni@colorado.edu) Received: from suburban.colorado.edu (suburban.colorado.edu [128.138.189.14]) by mx1.freebsd.org (Postfix) with ESMTP id 1A67213C48D for ; Tue, 30 Jan 2007 23:50:54 +0000 (UTC) (envelope-from John.Giacomoni@colorado.edu) Received: from [IPv6:::1] (suburban.colorado.edu [127.0.0.1]) by suburban.colorado.edu (8.13.1/8.13.1) with ESMTP id l0ULcogX008110 for ; Tue, 30 Jan 2007 16:38:50 -0500 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <200609090833.14856.davidxu@freebsd.org> References: <57213DB3-3D5A-4B11-AB29-5696DC4B3AC2@colorado.edu> <200609090833.14856.davidxu@freebsd.org> Content-Type: multipart/mixed; boundary=Apple-Mail-47-766824067 Message-Id: <722B66D4-4030-4C12-8C8D-8B3288F86498@colorado.edu> From: John Giacomoni Date: Tue, 30 Jan 2007 16:34:28 -0700 To: freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.752.2) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: pin/bind a pthread to a processor? (take 2) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2007 23:50:55 -0000 --Apple-Mail-47-766824067 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Previously when I asked this question it turned out to not be as necessary as I thought. However, I now need a way to pin/bind a user-space thread to a processor until I'm done with it as my timing constraints are too tight to account for. I checked sys/sched.h, sys/proc.h, pthread.h, and pthread_np.h but it doesn't look like an API to do this was added in 6.2. Can someone point me at a way to hack this in? I'm working on a conference submission and I unfortunately need to pin in user-space as abusing non-preemptive kernel threads is not sufficient for my task. The plan is to have 1-3 threads pinned through the execution of the test (30s - 10min, maybe more) but to leave a cpu untouched so that normal system function can continue on it. When pinning I'd also like to be able to pin to specific processors so I account for the effects placement of different dies, important for my work on dual-processor dual-core AMD systems where IO is routed via hypertransport through the first processor. For those who are interested, this work is focused on building pipeline-parallel systems that overlap sequential work by streaming data through a sequence of processors. One app that I've built with it is to support GigE forwarding at the maximum rate for all frame sizes through user-space. When this work is complete it may be able to help Daniel O'Connor and his question about streaming data from the kernel to userland (1/18/07). Additional information and papers are available at http://www.cs.colorado.edu/~jgiacomo thanks for any help! John G On Sep 8, 2006, at 6:33 PM, David Xu wrote: > On Saturday 09 September 2006 04:18, John Giacomoni wrote: >> Is it possible to bind a pthread to a processor in 5.5 or 6.1? >> >> I currently have a code base that uses libpthread with multiple >> threads, mutexes and condition variables. >> The problem I'm having is that I seem to be suffering wall-clock >> timing aberrations that I believe are introduced by the scheduler. >> >> Thanks, >> >> John G >> >> -- >> >> John.Giacomoni@colorado.edu >> University of Colorado at Boulder >> Department of Computer Science >> Engineering Center, ECCR 1B50 >> 430 UCB >> Boulder, CO 80303-0430 >> USA > > I don't think we have such API allowing you to bind a thread to > a specific CPU, I had implemented such an API for DragonFlyBSD, but > its 1:1 threading is not mature yet. > > David Xu > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers- > unsubscribe@freebsd.org" -- John.Giacomoni@colorado.edu University of Colorado at Boulder Department of Computer Science Engineering Center, ECCR 1B50 430 UCB Boulder, CO 80303-0430 USA --Apple-Mail-47-766824067 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-47-766824067--