Erlang (was: Re: Generics)

Ned Konz ned at bike-nomad.com
Mon Nov 10 21:18:52 UTC 2003


On Monday 10 November 2003 12:43 pm, Eric Merritt wrote:

> > What do you mean? We *have* cheap preemptive
> > multi-threading in Squeak.
> > Am I missing something?
>
>  I was under the impression that we had cheap
> cooperative threading. There is quite a difference
> between the two.

We have preemptive, priority-based threading. Processes will run until they're 
blocked (waiting for a semaphore), explicitly yield, or terminate. However, 
they may be preempted by a higher-priority Process that has become ready to 
run.

So we can easily force time-slicing between Processes at the same priority, by 
having them periodically preempted by a higher-priority Process. So (unlike 
in a straight cooperative model) one Process can't keep others at the same 
priority from being able to run.

> As regards cheap, from what I understand squeak has no
> problem with tens of thousands of concurrent
> processes. However, if we are comparing cheapness with
> erlang it would have to run nicely with hundreds of
> thousands of concurrent processes.

Don't know how well this would work, but it should work fairly well. Andreas 
may have tried it.

> > I don't understand. If you stop a process that can't
> > read data, you've blocked
> > it. How is this "non-blocking"?
>
>  Thats true, but only that one thread is blocked. All
> the other threads continue to function. If you are
> using system threads this isn't a big deal at all,
> however, all threads in erlang (and squeak for that
> matter) are green threads. This basically means that
> threading is in the vm and does not use native OS
> threads. In this case, not blocking the vm is very
> important.

We don't block the VM, or at least we don't have to.

We have async file and network support; a Process needing to do I/O to a 
resource that isn't ready can be blocked until that resource is ready without 
stopping other Processes.

There may well be code that is not using the async file support that should 
be, but that's a different matter altogether.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list