Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mimsy!nbs-amrf!libes From: libes@nbs-amrf.UUCP Newsgroups: comp.unix.wizards Subject: Re: A very interesting problem -- multiprocessing Message-ID: <514@nbs-amrf.UUCP> Date: Wed, 6-May-87 02:30:37 EDT Article-I.D.: nbs-amrf.514 Posted: Wed May 6 02:30:37 1987 Date-Received: Wed, 13-May-87 07:07:52 EDT References: <7176@brl-adm.ARPA> <4589@sci.UUCP> <2017@utah-gr.UUCP> Organization: National Bureau of Standards, Gaithersburg, MD Lines: 40 Summary: XINU provides multitasking in a single process Comer's XINU provides multitasking in a single process. If your coroutines explicitly give up control, you can use setjmp/longjmp. If you want preemptive scheduling, you must save the registers by hand with a little assembler, and set up a timer interrupt that calls the scheduler. I ported XINU to a 68k running 4.2 and it works great. Here is your program rewritten in XINU: void proc1() { for (;;) fprintf(stderr,"1"); } void proc2() { for (;;) fprintf(stderr,"2"); } user_main() { xresume(xcreate(proc1,2000,20,"proc1",0)); xresume(xcreate(proc2,2000,20,"proc2",0)); } The args to xcreate (X for Xinu to avoid conflicts with UNIX funcs) are 1) function, 2) stack size (I use 2000 because fprintf uses a lot!), 3) priority, 4) function name, 5) number of arguments to function, 6) optional arguments. Currently, the quantum size is compiled into the scheduler, but that could also be passed as an argument. I wrote this all up in a paper, and submitted it to USENIX but it was rejected. Now it's being studied by the ;login: folks. If they don't like it, perhaps I'll just give up and have it printed locally as a TR. I know it's not much, but so many people have expressed interest in it, I figure it must be worth printing somewhere. Any suggestions? Don Libes {seismo,mimsy}!nbs-amrf!libes