PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: vivoices on May 05, 2010, 09:11:53



Title: Is the MultiCore Version multithreading?
Post by: vivoices on May 05, 2010, 09:11:53
Does the AS3 MultiCore Version of PureMVC bring multithreading to Flash Builder 4 AIR applications?

Thanks,
David


Title: Re: Is the MultiCore Version multithreading?
Post by: jpwrunyan on May 06, 2010, 07:14:35
I'm going to go out on a limb here and say no.

First of all, Multicore is just a framework.  It does not affect the guts of the flash player, which leads to

Second, flash player cannot multi-thread (http://cookbooks.adobe.com/post_Is_multi_threading_possible_in_Flash_or_ActionScri-12026.html (http://cookbooks.adobe.com/post_Is_multi_threading_possible_in_Flash_or_ActionScri-12026.html)).  There are certain tricks you can do using the enter frame event, however, that may achieve the desired result.  But Multicore does not in and of itself contain any code for formalizing that process.  It's pretty rare to do so by the way.  In our huge spaghetti project, I use the enter frame trick only once to avoid a script timeout.  And meanwhile the dual CPU is chugging along at 50%.

PS
here's someone lamenting the lack of multi-threading in AIR: http://www.flexjunk.com/2009/01/15/multi-threading-in-flexair/ (http://www.flexjunk.com/2009/01/15/multi-threading-in-flexair/)


Title: Re: Is the MultiCore Version multithreading?
Post by: vivoices on May 07, 2010, 08:37:57
Thanks for your reply,
I was asking, because my imagination was running wild in the direction of:
1. AIR executes like a 'regular' application.
2. OS on multithreading machines can assign different CPUs to individual processes.
3. MultiCore PureMVC uses a separate AIR runtime for each of its MultiCores.
    One of them has a visible window showing the GUI surface.
    The other Cores run in background only.
4. OS assigns a different CPU to each of the PureMVC Cores.
5. PureMVC uses LocalConnections to 'combine forces' of the individual threads.
6. Voila > multithreading AIR application.

But as I said, only my imagination running wild.
 ;)


Title: Re: Is the MultiCore Version multithreading?
Post by: jpwrunyan on May 10, 2010, 01:45:25
Huh.  That is an interesting idea.  I had totally forgotten about LocalConnection.  I've always found it clunky.  But you are probably right, having two independent AIR applications that communicate with one another (one app being the master, the other the slave) might work on separate processors depending on the computer and the OS.  The master or shell could establish the other cores via the local connection I guess???  Is that what you are thinking?  It seems like a major pain, though!  ;)

Maybe someone will come along and make a LocalConnection Multi-thread utility for PureMVC???


Title: Re: Is the MultiCore Version multithreading?
Post by: puremvc on May 10, 2010, 09:04:11
Eh, you couldn't guarantee there wouldn't be processor affinity causing all the browser's plugins to run on a single core. That's OS level work.

-=Cliff>