Re: [Factor-talk] messaging between native vm threads

2009-10-24 Thread Slava Pestov
No native mutex is needed if you have a pair of pipes between every
two VMs that need to communicate. Then, one VM thread writes to the
pipe, another VM thread reads from it. Since a VM thread is so
heavy-weight (it has its own data heap) opening a handful of pipes is
nothing.

What you do need for correct semantics though is a lightweight lock
for co-operative threads (using the existing concurrency.locks), to
avoid the following race condition:

- co-operative thread A wants to send message to co-operative thread C in VM Y
- co-operative thread A writes message to pipe
- co-operative thread A yields because its doing blocking I/O
- co-operative thread B begins running
- co-operative thread B wants to send message to co-operative thread D in VM Y
- VM-thread X writes message to pipe, now two messaged are interleaved

To solve this you need to ensure that if a co-operative thread yields
while sending a message to a given VM, no other thread can send a
message before it is done, and a lock will accomplish exactly this.

Slava

On Fri, Oct 23, 2009 at 8:21 AM, Phil Dawes p...@phildawes.net wrote:
 Makes sense. I was hoping to just pass an fd/Handle on vm startup but I
 guess an alien address to a FD/mutex pair isn't much different. I'd have
 to do the same for a malloc'd message queue anyway.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Remove [let, [let*, [wlet and leave : to simplify locals?

2009-10-24 Thread Joe Groff
There's a bit of redundancy in locals. You can bind a variable  
using :, [let, or [let*, and the two latter forms just get  
transformed into the former behind the scenes. The [let forms also  
seem unnecessarily bulky compared to : . What would you all say to  
phasing out the [let forms and just leaving : ?

Also, nobody appears to use [wlet . Would anyone object to that being  
removed?

-Joe

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Remove [let, [let*, [wlet and leave : to simplify locals?

2009-10-24 Thread Jon Harper
: et [let are different because : can't be used everywhere.
From the docs:
Notes
This word ( : ) can only be used inside a lambda word, lambda
quotation or let binding form.

: toto ( a b -- c ) [let | b' [ 6 * ] | b' + ] ; ! works
: toto ( a b -- c ) 6 * : b' b' + ; ! does not work

I like the [let form better than :, but that's just my opinion, and
I'm very new to factor.


On Sun, Oct 25, 2009 at 11:20 AM, Joe Groff arc...@gmail.com wrote:
 There's a bit of redundancy in locals. You can bind a variable
 using :, [let, or [let*, and the two latter forms just get
 transformed into the former behind the scenes. The [let forms also
 seem unnecessarily bulky compared to : . What would you all say to
 phasing out the [let forms and just leaving : ?

 Also, nobody appears to use [wlet . Would anyone object to that being
 removed?

 -Joe

 --
 Come build with us! The BlackBerry(R) Developer Conference in SF, CA
 is the only developer event you need to attend this year. Jumpstart your
 developing skills, take BlackBerry mobile applications to market and stay
 ahead of the curve. Join us from November 9 - 12, 2009. Register now!
 http://p.sf.net/sfu/devconference
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk




-- 
Jon Harper

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk