[MacRuby-devel] Fibers and Enumerators

macruby at djc.net macruby at djc.net
Fri Aug 13 11:05:08 PDT 2010


> 
> The use case for me is somewhat more Easco is somewhat more practical. Most 
>servers on the Internet use a thread-per-request model, which is good for 
>concurrent workloads up to a few hundred concurrent requests. Yes, 
>technically you can allocate more threads on a modern system, but rarely have 
>I seen the number go much higher for a complex workload. Many of these 
>servers are I/O bound, so increasing the concurrency would increase 
>throughput. I'd like to take some of my workloads to 100,000+ concurrent 
>requests. Threads cannot help me at that scale. 
> 

Exactly so: GCD exists in part to solve this exact issue.
Without GCD, you must design you application "smartly" - i.e. not spawn a 
brand new thread per request, but that can also be done.
I would argue you don't want 100,000+ concurrent Fibers on a "standard" 
server, either (see ruby-doc.org / impl : they are not nearly as lightweight 
as you might think).

So: while I understand Easco's example, I don't see Fibers as unique, or nec. 
top choice, for a clean design of this scenario.

Perhaps this topic should go offline, since this is leaving the land of 
MacRuby [direct]....

-Daniel


> That may sound like an esoteric use case, but with websockets and Comet, 
>it's actually pretty common. 
> 
> Sent from my iPhone
> 
> On Aug 13, 2010, at 10:15 AM, "Ernest N. Prabhakar, Ph.D." 
><prabhaka at apple.com> wrote:
> 
>> Hi Easco,
>> 
>> On Aug 13, 2010, at 8:15 AM, easco wrote:
>>> Instead I was curious to know if there was "a plan" for implementing Fibers 
>>>and if so, I was curious to know what operating system technology they would 
>>>be built on.  It appears that the problem has not been looked at, in-depth, 
>>>yet and I am satisfied with that.  Nor does it appear that there is any OS 
>>>level technology that would particularly support the creation of Fibers (i.e. 
>>>Mac OS X doesn't really have any built-in support for cooperatively scheduled 
>>>multitasking... outside of deprecated technologies like the Carbon Thread 
>>>Manager and makecontext/swapcontext).
>> 
>> Actually, I'm confused by that statement. My understanding is that 
>>cooperatively scheduled threads is a just a subset of the system-scheduled 
>>model.
>> 
>> In particular, I'm pretty sure you can emulate them on top of GCD using 
>>semaphores.  Should I explain further, or did you already consider that and 
>>discover it was unworkable?
>> 
>> -- Ernie P.
>> 
>> 
>> 
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list