IRIX64 alignment problem

2002-08-31 Thread Steven W McDougall
I checked out Parrot from CVS on 2002Aug30 to an IRIX64 system. shell01:/usr/tmp/swmcd/parrot>uname -a IRIX64 shell01 6.5 07201611 IP27 make compiled OK. make test failed all the t/pmc/perlhash.t tests. Running parrot t/pmc/perlhash_1.pbc produced a bus error. I chased the err

Re: RFCs for thread models

2000-09-09 Thread Steven W McDougall
> SWM> If you actually compile a Perl program, like > > SWM> $a = $b > > SWM> and then look at the op tree, you won't find the symbol "$b", or "b" > SWM> anywhere in it. The fetch() op does not have the name of the variable > SWM> $b; rather, it holds a pointer to the value for $b. > > W

RFCs for thread models

2000-09-09 Thread Steven W McDougall
RFC 178 proposes a shared data model for Perl6 threads. In a shared data model - globals are shared unless localized - file-scoped lexicals are shared unless the thread recompiles the file - block scoped lexicals may be shared by - passing a reference to them - closures - declaring one s

Re: RFC 178 (v2) Lightweight Threads

2000-09-08 Thread Steven W McDougall
> Example > > @a = (); > async { push @a, (1, 2, 3) }; > push @a, (4, 5, 6); > print @a; > > Possible output: 142536 Actually, I'm not sure I understand this. Can someone show how to program push() on a stack machine? - SWM

Re: RFC 178 (v2) Lightweight Threads

2000-09-08 Thread Steven W McDougall
> > You aren't being clear here. > > > > fetch($a) fetch($a) > > fetch($b) ... > > add ... > > store($a) store($a) > > > > Now all of the perl internals are done 'safely' but the result is garbage. > >

Re: RFC 178 (v2) Lightweight Threads

2000-09-07 Thread Steven W McDougall
> I think there may be a necessity for more than just a work area to be > non-shared. There has been no meaningful discussion so far related to > the fact that the vast majority of perl6 modules will *NOT* be threaded, > but that people will want to use them in threaded programs. That is a > non

Re: RFC 178 (v2) Lightweight Threads

2000-09-06 Thread Steven W McDougall
> what if i do $i++ and overflow into the float (or bigint) domain? that > is enough work that you would need to have a lock around the ++. so then > all ++ would have implied locks and their baggage. i say no atomic ops > in perl. >From RFC 178 [Atomic] operations typically lock their opera

Re: RFC 178 (v2) Lightweight Threads

2000-09-06 Thread Steven W McDougall
> DS> Some things we can guarantee to be atomic. > This is going to be tricky. A list of atomic guarentees by perl will be > needed. >From RFC 178 ...we have to decide which operations are [atomic]. As a starting point, we can take all the operators documented in C and all the functions docume

Re: RFC 178 (v2) Lightweight Threads

2000-09-05 Thread Steven W McDougall
> DS> I'd definitely rather perl not do any sort of explicit user-level locking. > DS> That's not our job, and there be dragons. > Please explain how this is possible? Just say no...to locks. > Does this mean that without user specifying a lock, perl will allow > a chaotic update pattern to b

Re: RFC 178 (v1) Lightweight Threads

2000-09-04 Thread Steven W McDougall
I think we are talking about the same issues, but we can't seem to get in sync on the terminology. I'm going to try to get off the merry-go-round by recapitualting the two approaches. RFC178 - globals are shared unless localized - file-scoped lexicals are shared by all code in the file - block-s

Re: RFC 178 (v1) Lightweight Threads

2000-09-04 Thread Steven W McDougall
> Single thingee access mediation, should be done automatically by perl. > The multi-thingee complex mediation should have the user step in, since > solving it (correctly and efficiently) is a complex problem. I'm not sure we have a common understanding of the terms we are using. Can you give som

Re: RFC 178 (v2) Lightweight Threads

2000-09-04 Thread Steven W McDougall
What I'm trying to do in RFC178 is take the thread model that you get in compiled languages like C and C++, and combine it with the Perl5 programming model in a way that makes sense. There may be reasons not to follow RFC178 in Perl6. Maybe - it's too hard to implement - there are performance pr

Re: RFC 178 (v1) Lightweight Threads

2000-09-04 Thread Steven W McDougall
> SWM> Question: Can the interpreter determine when a variable becomes > SWM> shared? > SWM> Answer: No. Then neglecting to put a :shared attribute on a shared > SWM> variable will crash the interpreter. This doesn't seem very Perlish. > Err, no. It won't crash the interpreter. It'll make the sc

Re: RFC 178 (v1) Lightweight Threads

2000-09-03 Thread Steven W McDougall
> There is a fundemental issue on how values are passed between > threads. Does the value leave one thread and enter the other or are > they shared. > The idea tossed around -internals was that a value that crosses a thread > boundary would have a wrapper/proxy attached to handle the mediation.

Re: RFC 178 (v1) Lightweight Threads

2000-09-03 Thread Steven W McDougall
> There is a fundemental issue on how values are passed between > threads. Does the value leave one thread and enter the other or are > they shared. > The idea tossed around -internals was that a value that crosses a thread > boundary would have a wrapper/proxy attached to handle the mediation.

Re: RFC 185 (v1) Thread Programming Model

2000-09-02 Thread Steven W McDougall
> > I dropped the I<$thread>->C call from this interface, and didn't > > say what happens if a thread Cs. There are several possibilities > I think that the try stack should unwind all the way through the new Thread > call -- that is, that the catches for the block that the thread was started > i

Re: RFC 178 (v1) Lightweight Threads

2000-09-01 Thread Steven W McDougall
> KF> #!/my/path/to/perl > KF> sub foo_generator { my $a = shift; sub { print $a++ } } > KF> my $foo = foo_generator(1); > KF> $foo->(); > Thread-> new($foo); > KF> Is $a shared between threads or not? If $a is not shared, we've broken > KF> lexicals. > Not unless it is so declar

Re: RFC 185 (v1) Thread Programming Model

2000-09-01 Thread Steven W McDougall
> I'm not completely sure what you are trying to do with this RFC. This RFC describes the programming interface to Perl6 threads. It documents the function calls, operators, classes, methods, or whatever else the language provides for programming with threads. Perl5 has a thread interface, bu

Re: RFC 178 (v1) Lightweight Threads

2000-08-31 Thread Steven W McDougall
> Steven W McDougall wrote: > > > The more interesting case is this: > > > > > > #!/my/path/to/perl > > > sub foo_generator { my $a = shift; sub { print $a++ } } > > > my $foo = foo_generator(1); > > > $foo->(); > >

Re: RFC 178 (v1) Lightweight Threads

2000-08-31 Thread Steven W McDougall
> The more interesting case is this: > > #!/my/path/to/perl > sub foo_generator { my $a = shift; sub { print $a++ } } > my $foo = foo_generator(1); > $foo->(); > Thread->new($foo); > Is $a shared between threads or not? $a is shared between threads. The anonymous subroutine

Re: Are Perl6 threads preemptive or cooperative?

2000-08-27 Thread Steven W McDougall
> That a user my need to have two or more variables in sync for proper > operation. And cooperative threads don't address that issue. > Cooperative only helps _perhaps_ with perl not needing to protrect its > own structures. We are in agreement. I was specifically addressing the problem of prot

Re: Threads and run time/compile time

2000-08-27 Thread Steven W McDougall
> > We could either discuss alternate approaches for RFC1, or I could > > submit a new RFC for a thread architecture that gives me the > > performance I want. > Both are more than welcome. (If you want alternate approaches or > counter-arguments to be fully documented, then doing both in an RFC

Re: Threads and run time/compile time

2000-08-27 Thread Steven W McDougall
> > as in the non-threaded case, or do we get > > > > $global::{foo} -> *global::foo -> &global::foo -> { print 1 } > > $thread::{foo} -> *thread::foo -> &thread::foo -> { print 2 } > Okay, I understand. Here's how I perceive it > > There is no global::foo, just two thread-specific

Re: Are Perl6 threads preemptive or cooperative?

2000-08-27 Thread Steven W McDougall
I don't understand the problem with these scenarios. > A couple of other scenerios > > Thread 1Thread 2 > push(@a, @b); $a[35]++ > What does > User level cross variable consistancy. mean? > > push(@a, $b); > $acount++ if $b <35; > > > E

Re: Threads and run time/compile time

2000-08-26 Thread Steven W McDougall
>> Users can (and do) write open code in modules. > I don't understand. Do you think that needs to be prevented? No, I just want to know what happens when they do it. Let's look at an example. 1. Non-threaded #!/usr/local/bin/perl sub foo { print 1 } foo(); eval 'sub foo { pr

Threads and run time/compile time

2000-08-25 Thread Steven W McDougall
RFC1v3 says 5. Threads are a runtime construct only. Lexical scoping and compile issues are independent of any thread boundaries. The initial interpretation is done by a single thread. use Threads may set up the thread constructs, but threads will not be spawned until runtime.

Threads and file-scoped lexicals

2000-08-25 Thread Steven W McDougall
Do separate threads - all see the same file-scoped lexicals - each get their own file-scoped lexicals #!/usr/local/bin/perl use Threads; my $a = 0; my $t1 = Thread->new(\&inc_a); my $t2 = Thread->new(\&inc_a); $t1->join; $t2->join; print "$a"; sub inc_a { $a++; } What should the outp

Re: Are Perl6 threads preemptive or cooperative?

2000-08-25 Thread Steven W McDougall
> The problem is, as long as expressions can be within each other, > and include terms that are multiple expressions, a robust deadlock > avoidance strategy is required even with cooperative threading. In order to understand this, we need to think in more detail about how the Perl interpreter wor

Re: Are Perl6 threads preemptive or cooperative?

2000-08-25 Thread Steven W McDougall
> Writing a threads package correctly is a non-trivial thing to do. We don't have to write a threads package. We just have to thread the interpreter. There's a difference. > Perl doesn't currently run on a system that doesn't have a reasonably good > threading library. I abandoned an NT -> M

Re: RFC 145 (v2) Brace-matching for Perl Regular Expressions

2000-08-25 Thread Steven W McDougall
> A new regular expression metacharacter \m would match any of the > following characters: ([{"'< in a regexp. A later \M metacharacter > would match the corresponding closing pair character )]{"'> > I within the string being searched. ^ LanguageReco

Are Perl6 threads preemptive or cooperative?

2000-08-24 Thread Steven W McDougall
Are Perl6 threads preemptive or cooperative? Last week, I asked whether Perl6 threads support SMP. There were a handful of responses, mostly to the effect that - we don't know - we don't care - we get whatever the native thread library gives us This assumes that Perl6 uses the native thread lib

Thread usage cases

2000-08-18 Thread Steven W McDougall
1. Scalars Thread1 Thread2 $a = 1; $a = 2; $a is set to 1 and then 2, or 2 and then 1. It just depends which thread gets there first. 2. Arrays Thread1 Thread2 push @a, (1, 2, 3); push @a, (4, 5, 6); The interesting question

Thread programming model

2000-08-18 Thread Steven W McDougall
I've spent the last 3 years programming WindowsNT threads in MSVC++, and I *really* like it. I want similar capabilities in Perl6. 1 The C++ thread model Here is the thread model that I have in C++. It is a starting point for thinking about what I want in Perl. Every thread sees - the same code

Do threads support SMP?

2000-08-18 Thread Steven W McDougall
Does Perl6 support Symmetric MultiProcessing (SMP)? This is a *huge* issue. It affects everything else that we do with threads. 1 No If Perl6 doesn't support SMP, then the interpreter can be implemented with cooperative threads. It calls yield() internally to switch threads, and by design, it o