From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <4549906437a668a8f1064647e6b21c64@quanstro.net> References: <4549906437a668a8f1064647e6b21c64@quanstro.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9812253A-69A9-428E-8210-1BD804F70693@mac.com> Content-Transfer-Encoding: 7bit From: Pietro Gagliardi Subject: Re: [9fans] Got thread experience? Date: Thu, 25 Oct 2007 17:05:57 -0400 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: d97c82a6-ead2-11e9-9d60-3106f5b1d025 /* there are threads in plan 9 */ #include #include #include int killme = 0, i = 0, x = 0; void thread_task(void *data) { i++; if (i > 2000) { x++; killme = x > 200; } } /* threadmain() instead of main() - requires argc, argv */ void threadmain(int argc, char *argv[]) /* must use *argv[] - not **argv or argv[][] */ { int tid; tid = threadcreate(thread_task, 0, 2048); /* (function, argument, stack size) */ if (tid < 0) sysfatal("could not create thread"); while (!killme) { print(1, "waiting\n"); sleep(2000); /* wait two seconds */ } threadexitsall(0); /* use instead of exits() - with all suffix, terminates all threads */ } On Oct 25, 2007, at 4:51 PM, erik quanstrom wrote: >> So, those with experience with threading implementations on weird >> real-time or embedded operating systems: >> >> Have you ever ran into a thread implementation where two threads >> could *not* directly access each other's .bss (or equiv)/heap? >> >> i.e. have you ever encountered a scenario where sibling threads >> actually had completely separate sets of page tables? > > under plan 9, don't we call those processes? > > that doesn't sound like any imbedded environment i've worked in. > it's getting mighty fancy to have one set of pagetables. ;-) > > - erik >