Date: Mon, 28 Jan 2002 15:33:44 -0800 (PST) From: Julian Elischer <julian@elischer.org> To: arch@freebsd.org Subject: KSE milestone 3 reached. Message-ID: <Pine.BSF.4.21.0201281459080.42040-100000@InterJet.elischer.org>
next in thread | raw e-mail | index | archive | help
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 <stdio.h> #include <stdlib.h> #include <ksethreads.h> /************************************************************* * 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0201281459080.42040-100000>