9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] simulation and newsqueak
@ 2008-05-30 22:27 Skip Tavakkolian
  2008-05-30 22:53 ` Pietro Gagliardi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Skip Tavakkolian @ 2008-05-30 22:27 UTC (permalink / raw)
  To: 9fans

i need to build a monte carlo simulator to model a system.  i
was first thinking of using libthread and channels, etc.  but i'm
wondering if newsqueak would be a better fit. has it been used
for this?

the kenc specific pragmas in the sources on rob's site seem to hint
that it ran on plan9 at some point but i can't see it on sources?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] simulation and newsqueak
  2008-05-30 22:27 [9fans] simulation and newsqueak Skip Tavakkolian
@ 2008-05-30 22:53 ` Pietro Gagliardi
  2008-05-30 23:11   ` Iruata Souza
  2008-05-31  2:06 ` Bakul Shah
  2008-05-31  5:29 ` Rob Pike
  2 siblings, 1 reply; 7+ messages in thread
From: Pietro Gagliardi @ 2008-05-30 22:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Have you done a port of Newsqueak to Plan 9? I tried using Rob's
original code (and failed, albeit not very miserably).

What do you mean by "monte carlo" - the solitaire? Perhaps a look at
the concept would be helpful.

On May 30, 2008, at 6:27 PM, Skip Tavakkolian wrote:

> i need to build a monte carlo simulator to model a system.  i
> was first thinking of using libthread and channels, etc.  but i'm
> wondering if newsqueak would be a better fit. has it been used
> for this?
>
> the kenc specific pragmas in the sources on rob's site seem to hint
> that it ran on plan9 at some point but i can't see it on sources?
>
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] simulation and newsqueak
  2008-05-30 22:53 ` Pietro Gagliardi
@ 2008-05-30 23:11   ` Iruata Souza
  0 siblings, 0 replies; 7+ messages in thread
From: Iruata Souza @ 2008-05-30 23:11 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, May 30, 2008 at 7:53 PM, Pietro Gagliardi <pietro10@mac.com> wrote:
> Have you done a port of Newsqueak to Plan 9? I tried using Rob's original
> code (and failed, albeit not very miserably).
>
> What do you mean by "monte carlo" - the solitaire? Perhaps a look at the
> concept would be helpful.
>

http://www.isv.uu.se/~ingelman/graduate_school/courses/montecarlo/

iru



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] simulation and newsqueak
  2008-05-30 22:27 [9fans] simulation and newsqueak Skip Tavakkolian
  2008-05-30 22:53 ` Pietro Gagliardi
@ 2008-05-31  2:06 ` Bakul Shah
  2008-05-31  5:29 ` Rob Pike
  2 siblings, 0 replies; 7+ messages in thread
From: Bakul Shah @ 2008-05-31  2:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 30 May 2008 15:27:12 PDT Skip Tavakkolian <9nut@9netics.com>  wrote:
> i need to build a monte carlo simulator to model a system.  i
> was first thinking of using libthread and channels, etc.  but i'm
> wondering if newsqueak would be a better fit. has it been used
> for this?

Why Newsqueak?  Why not roll your own simulation kernel?
Basically you need

    new_thread(function, argument, stackksize);
    condition = new_condition();
    busy(how_many_time_units);
    wait(condition);
    signal(condition);
    yield();	// may be

You do need stack switching code in asm or use setjmp/longjmp
for it but the rest is pretty easy.  The scheduler is a
priority queue of (time-to-run,thread), each condition has a
list of waiter threads, busy(n) puts the current thread on
the schedule to run n time units in future, wait(cond) puts
the current thread on the waiter list of cond, signal(cond)
moves all waiter threads to the run-queue and yield()s etc.
This simulation kernel is likely to be more efficient than a
generic threads package.  As an example, on a 1.5Ghz P4 (IBM
T42) per thread context switch time is about 56ns for 1000
threads, increasing to about 490ns for 100,000 threads.

You can use one or more threads to generate random events
with whatever probabilistic distribution you want.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] simulation and newsqueak
  2008-05-30 22:27 [9fans] simulation and newsqueak Skip Tavakkolian
  2008-05-30 22:53 ` Pietro Gagliardi
  2008-05-31  2:06 ` Bakul Shah
@ 2008-05-31  5:29 ` Rob Pike
  2008-05-31 12:53   ` Pietro Gagliardi
  2 siblings, 1 reply; 7+ messages in thread
From: Rob Pike @ 2008-05-31  5:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

The Unix source is on my web site.

-rob



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] simulation and newsqueak
  2008-05-31  5:29 ` Rob Pike
@ 2008-05-31 12:53   ` Pietro Gagliardi
  2008-05-31 14:09     ` Russ Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Pietro Gagliardi @ 2008-05-31 12:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On May 31, 2008, at 1:29 AM, Rob Pike wrote:

> The Unix source is on my web site.
>
> -rob
>

And I had lots of problems porting that to Plan 9. It works well on my
Mac, though.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] simulation and newsqueak
  2008-05-31 12:53   ` Pietro Gagliardi
@ 2008-05-31 14:09     ` Russ Cox
  0 siblings, 0 replies; 7+ messages in thread
From: Russ Cox @ 2008-05-31 14:09 UTC (permalink / raw)
  To: 9fans

> And I had lots of problems porting that to Plan 9.

This is a totally useless comment.
If you said something about what the
problems were, then maybe people
on the list might be more willing to help you.

9fans is a mailing list, not IRC.

Russ



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-05-31 14:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-30 22:27 [9fans] simulation and newsqueak Skip Tavakkolian
2008-05-30 22:53 ` Pietro Gagliardi
2008-05-30 23:11   ` Iruata Souza
2008-05-31  2:06 ` Bakul Shah
2008-05-31  5:29 ` Rob Pike
2008-05-31 12:53   ` Pietro Gagliardi
2008-05-31 14:09     ` Russ Cox

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).