--- xinu/sys/test.c 2018/04/24 17:39:04 1.1.1.1 +++ xinu/sys/test.c 2018/04/24 17:39:56 1.1.1.2 @@ -1,27 +1,34 @@ -/* test.c - main */ +#include +int workcount = 0; -#include -#include -#include - -/*------------------------------------------------------------------------ - * main -- start UDP echo server and then run Xinu pseudo-shell - *------------------------------------------------------------------------ - */ main() { - int udpecho(); - - /* start rwho daemon and input processes */ + int nwork, work(); - rwho(); - - /* start UDP echo server */ + printf("Enter cycles of work to do: "); + scanf("%d",&nwork); + resume(create(work,1000,20,"worker",1,nwork)); + while (1) + { + getc(CONSOLE); /* wait for from keyboard */ + printf("worker at # %d\n",workcount); + } +} - resume( create(udpecho, 800, 30, "UDPecho", 0) ); +work(ncycles) +{ + int i; + printf("Worker starting\n"); + for (i=1;i<=ncycles;i++) + { + docycle(i); /* do ith work cycle */ + workcount++; /* count it where parent can see it */ + } +} - while (TRUE) { - login(CONSOLE); - shell(CONSOLE); - } +docycle(n) +int n; +{ + int i; + for (i=0;i