From owner-freebsd-arch@FreeBSD.ORG Sat Apr 24 19:29:59 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E44AF106566B; Sat, 24 Apr 2010 19:29:59 +0000 (UTC) (envelope-from matthew.fleming@isilon.com) Received: from seaxch09.isilon.com (seaxch09.isilon.com [74.85.160.25]) by mx1.freebsd.org (Postfix) with ESMTP id C65788FC15; Sat, 24 Apr 2010 19:29:59 +0000 (UTC) Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Sat, 24 Apr 2010 12:29:59 -0700 x-mimeole: Produced By Microsoft Exchange V6.5 Message-ID: <06D5F9F6F655AD4C92E28B662F7F853E021D4D37@seaxch09.desktop.isilon.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: GDC/libdispatch for kernel Thread-Index: Acrj5IcQ+uJZCoMQT6CdM8qdOSWV3g== From: "Matthew Fleming" To: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: rwatson@freebsd.org Subject: GDC/libdispatch for kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2010 19:30:00 -0000 I have the need for a simple mechanism to farm off work blocks that will = be run on other processors if there is spare compute time, and on the = current CPU if there is not any spare time. An example of something I want to do is compute an error correcting code = and a crc32 checksum on a block of data, potentially while also dealing = with system resources so the block can be written to disk. I dont want to reinvent the wheel, and the GCD framework looks like it = would provide what I want in dispatch groups run on a parallel queue. = However, theres a lot of things supported in GCD that I dont need (now = and possibly ever). Has anyone done any work to support some of the GCD functions in the = kernel? If not, how useful would other people find such a thing? In my = specific instance, I was thinking along the lines of having the idle = thread run a dispatch object off a global queue, setting its priority to = the curthread->td_priority of the thread that initiated the dispatch, in = order to prevent priority inversions. I dont want the farmed off work = to preempt anything else useful the system may have to do, which is why = I was considering the idle threads (or my own threads running at = PRI_MAX_IDLE-1 until they have work). However, I dont think this implementation is really in the spirit of the = rest of the GCD architecture. So in addition to wondering if there is = an existing BSD-licensed code to do such a thing, I also am wondering = what direction the community can provide on a few design points to make = this useful both for me and for the general community. I will be at BSDCan but I need something usable (for me, at least) next = week to fix some issues at work. Meanwhile, one other question I had was regarding the name of all the = dispatch_foo_t objects, which are typedefs of a pointer-to-struct. This = is explicitly frowned upon in style(9), so would it be better to be = consistent with libdispatch names or style(9)? I would tend to assume = style(9). Thanks, matthew