Process fork/yield

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Process fork/yield

Ang BeePeng
Hi,

The following method will not reach forkAt: 30. Is that true?

[[true]
                whileTrue: [SqueakDLL processDLLString]] forkAt: 30


If that is the case, will "Processor yield" do the job? Why is it?

[true]
                whileTrue: [SqueakDLL processDLLString.
                                Processor yield.]

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Process fork/yield

Levente Uzonyi-2
On Mon, 12 Apr 2010, Ang BeePeng wrote:

>
> Hi,
>
> The following method will not reach forkAt: 30. Is that true?
>
> [[true]
> whileTrue: [SqueakDLL processDLLString]] forkAt: 30

No, #forkAt: will be reached. The above code has the following form:
[ <some code here> ] forkAt: 30.
When this is evaluated, a block will be created (copied actually) with
the infinite loop. The block won't be evaluated until you send #forkAt: to
it.


Levente

>
>
> If that is the case, will "Processor yield" do the job? Why is it?
>
> [true]
> whileTrue: [SqueakDLL processDLLString.
>                                Processor yield.]
>
> Thanks.
>
> Ang Beepeng
> --
> View this message in context: http://n4.nabble.com/Process-fork-yield-tp1837475p1837475.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Process fork/yield

Ang BeePeng
Hi,

Thanks for your reply.

Using #forkAt: without a #wait will cause processes at lower priority halt? Processes with lower priority wouldn't stand a chance to run, is that right?


To make it clear, I mean I have this two run at the same time.
[ BLOCK A ] forkAt: 20.
[ BLOCK B ] forkAt: 30.
BLOCK A do not get to run, if there's no #wait in BLOCK B. Am I right?


Thank you so much for helping. I find it hard to learn about process from existing code.

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: Process fork/yield

Levente Uzonyi-2
On Tue, 13 Apr 2010, Ang BeePeng wrote:

>
> Hi,
>
> Thanks for your reply.
>
> Using #forkAt: without a #wait will cause processes at lower priority halt?
> Processes with lower priority wouldn't stand a chance to run, is that right?

If there's a higher priority process ready to run, it will run, so lower
priority processes will have to wait.

>
>
> To make it clear, I mean I have this two run at the same time.
> [ BLOCK A ] forkAt: 20.
> [ BLOCK B ] forkAt: 30.
> BLOCK A do not get to run, if there's no #wait in BLOCK B. Am I right?

Yes, if the process evaluating BLOCK B is never suspended, then BLOCK A
will not be evaluated.

>
>
> Thank you so much for helping. I find it hard to learn about process from
> existing code.

There are docs available, for example: http://wiki.squeak.org/squeak/382


Levente

>
> Thanks.
>
> Ang Beepeng
> --
> View this message in context: http://n4.nabble.com/Process-fork-yield-tp1837475p1838229.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>