From: Pietro Gagliardi <pietro10@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] Got thread experience?
Date: Thu, 25 Oct 2007 17:05:57 -0400 [thread overview]
Message-ID: <9812253A-69A9-428E-8210-1BD804F70693@mac.com> (raw)
In-Reply-To: <4549906437a668a8f1064647e6b21c64@quanstro.net>
/* there are threads in plan 9 */
#include <u.h>
#include <libc.h>
#include <thread.h>
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
>
next prev parent reply other threads:[~2007-10-25 21:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-25 20:48 don bailey
2007-10-25 20:51 ` erik quanstrom
2007-10-25 21:01 ` don bailey
2007-10-25 21:06 ` erik quanstrom
2007-10-25 21:13 ` don bailey
2007-10-25 21:17 ` erik quanstrom
2007-10-25 21:17 ` Pietro Gagliardi
2007-10-25 21:05 ` Pietro Gagliardi [this message]
2007-10-25 21:12 ` don bailey
2007-10-25 21:28 ` Charles Forsyth
2007-10-25 21:44 ` roger peppe
2007-10-25 23:30 ` Andy Newman
2007-10-26 15:30 ` don bailey
2007-10-25 22:12 ` David Leimbach
2007-10-25 21:35 ` Sape Mullender
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9812253A-69A9-428E-8210-1BD804F70693@mac.com \
--to=pietro10@mac.com \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).