From owner-freebsd-arch Mon Jan 28 15:40:21 2002 Delivered-To: freebsd-arch@freebsd.org Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by hub.freebsd.org (Postfix) with ESMTP id 454A737B402 for ; Mon, 28 Jan 2002 15:40:10 -0800 (PST) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc52.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020128234009.SDLN3578.rwcrmhc52.attbi.com@InterJet.elischer.org> for ; Mon, 28 Jan 2002 23:40:09 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id PAA48240 for ; Mon, 28 Jan 2002 15:33:45 -0800 (PST) Date: Mon, 28 Jan 2002 15:33:44 -0800 (PST) From: Julian Elischer To: arch@freebsd.org Subject: KSE milestone 3 reached. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In October or so I stated that Milestone 3 would be when a test program could run several threads concurrently doing system calls (on one processor at the moment). I have reached that point however I need to 'back-fill' with the help of others to fix things that I seem to have broken, for example I think I've broken gdb's ability to control procrsses. Anyhow, The following program, when linked with a small library (not supplied) yeilds the following expected result: A non-library version of this program is available with the patches at http://www.freebsd.org/~julian. program: #include #include #include /************************************************************* * code for three separate threads. (so we can see if it works) *************************************************************/ static void thread1_code(void *arg) { for(;;) { sleep (1); write(1,".",1); } } static void thread2_code(void *arg) { for(;;) { sleep (3); write(1,"+",1); } } static void thread3_code(void *arg) { for(;;) { sleep (5); write(1,"=",1); } } int main() { /* set up global structures */ TAILQ_INIT(&runqueue); /* define two threads to run, they are runnable but not yet running */ make_bg_thread(&thread1_code, 0, NULL); make_bg_thread(&thread2_code, 0, NULL); /* start two KSEs in different KSEGRPs */ if (startkse(&first_kse)) { perror("failed to start KSE"); exit(1); } /* and one which we will run ourself */ makemainthread(&thread3_code, 0, NULL); thread3_code(NULL); return 0; } A more convenient interface would be easy to figure out.. this is just for debugging.. result: (line wrap added by me) # /ksetest/ksetest ..+..=.+...+.=..+...=+...+..=.+...+.=..+...=+...+..=.+...+.=..+...=+...+..= .+...+.=..+...=+...+..=.+...+.=^C#D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message