From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 21 21:28:46 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70D4916A4C2; Sat, 21 Oct 2006 21:28:46 +0000 (UTC) (envelope-from ekkehard.morgenstern@onlinehome.de) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by mx1.FreeBSD.org (Postfix) with ESMTP id E607C43D64; Sat, 21 Oct 2006 21:28:38 +0000 (GMT) (envelope-from ekkehard.morgenstern@onlinehome.de) Received: from [84.173.242.137] (helo=[192.168.0.136]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), id 0MKxQS-1GbOOO3BPx-0005gA; Sat, 21 Oct 2006 23:28:33 +0200 From: Ekkehard Morgenstern To: John-Mark Gurney Date: Sat, 21 Oct 2006 23:27:13 +0200 User-Agent: KMail/1.9.1 References: <200610150326.03279.ekkehard.morgenstern@onlinehome.de> <200610171717.30834.davidxu@freebsd.org> <20061020212457.GQ23971@funkthat.com> In-Reply-To: <20061020212457.GQ23971@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610212327.13790.ekkehard.morgenstern@onlinehome.de> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:9985dda5cbe98f4670734048a5dbacd9 Cc: freebsd-hackers@freebsd.org, Divacky Roman , David Xu Subject: Re: Threading system calls (int 80h) 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: Sat, 21 Oct 2006 21:28:46 -0000 On Friday 20 October 2006 23:24, John-Mark Gurney wrote: > That's why you use rfork_thread(3)... Thanks! That really helps! :-) What I'm trying to do is to write a virtual machine in assembly language on FreeBSD that can be run right after the kernel has been loaded. I would like to avoid external library dependencies, so, for threading, I need some mechanism to make it possible with kernel calls only. I'll be looking at the THR calls as well, but it helps my confidence that rfork(2) and rfork_thread(3) are documented. I'm not sure if I understood the FreeBSD threading mechanism correctly. Are threads always processes? Then it would make no difference if I fork instead of using specific threading calls. I would like to enable the users of my VM to take advantage of multiple CPUs, so a process-based solution doesn't look so bad. How much overhead is involved in FreeBSD multitasking? I will probably also implement a virtual threading mechanism, because every VM process or thread can also multiplex instruction streams scheduled to run concurrently, at least as long as they're interpreted and not converted to native code yet. When the number of virtual threads exceeds a configurable limit, a real thread or process can be created that can run further virtual threads. Does anyone of you have any further recommendations or advice? I would like to pick a solution that can perform optimally on FreeBSD. - Ekkehard.