realbasic-nug.fr
[Top] [All Lists]

Re: RealBasic et le multi-processing

To: REALbasic NUG French <realbasic-nug dot fr at lists dot realsoftware dot com>
Subject: Re: RealBasic et le multi-processing
From: Stephane Pinel <stephane at realsoftware dot fr>
Date: Fri, 14 Dec 2007 18:50:57 +0100
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug dot fr at lists dot realsoftware dot com
References: <C387F5AD dot FA6F%lveillette at silexmultimedia dot com> <DDA9F0EF-3529-4D86-913C-B61E50BAC0A9 at mac dot com>
"Le coopératif est ce qui existait sous MacOS 9 et sous les vieilles versions de Windows 95 et 98. Les OS modernes implémentent tous le préemptif."

.... Les OS oui. Mais les applications ? Peu en fait....

---
Enregistrez-vous dès aujourd'hui pour REAL World 2008
<http://www.realsoftware.com/realworld>

---
Stéphane Pinel - REAL Software
Support Technique en Français
43, Rue Marius Aufan 92300 Levallois-Perret (FR)
http://www.realsoftware.fr

Rejoignez la communauté francophone des développeurs REALbasic :
<http://www.realsoftware.com/support/listmanager/>

Le 14 déc. 07 à 18:45, patrick santoni a écrit :


Le 14 déc. 07 à 14:56, lveillette a écrit :


Erreur, si ma mémoire est bonne il revient alors au OS de distribuer les tâches en fonction des processeurs disponibles. Cependant, cette technique n'est pet-être pas aussi efficace que lorsqu'un programmeur peut gèrer
lui-même cet aspect.


Aaron Balman  a écrit ceci :

There are two different threading models that are commonly used: preemptive threads and cooperative threads. With a preemptive thread, the OS has a set time slice that each thread executes in. When the thread’s time slice is done, then the OS switches to another thread immediately. This causes all sorts of headaches for the programmer because that context switch could be happening in the middle of executing a line of code. This means you need to take special care when accessing any shared data and you can’t make assumptions about what code has been executed between threads. Basically, it’s much (much) easier to crash your application in strange and hard to reproduce ways when using preemptive threads. Thankfully, REALbasic uses the other threading model: cooperative. In this model, the threads need to cooperate with one another by telling the OS “I’m done now, please switch me out.” We do this switching for you at certain boundary cases — while evaluating a looping construct (like for or while loops), at the end of methods, etc. The downside to cooperative threads is that external (to the REALbasic framework) code needs to be able to alert the framework that a context switch is ok to do. We give plugin authors a way to do this, however, not all of them do it. And calling into declares certainly don’t have a way to do this.

Autrement dit :

gérer des processus légers préemptifs est certes délicat, mais cela ouvre la voie à l'emploi de plusieurs coeurs. RB qui est un produit conçu dans les années 98,me semble-t-il, à une époque où n'existait pas de systèmes préemptifs sur micro s'est rallié au coopératif, plus simple à gérer mais désormais obsolète.

Le coopératif est ce qui existait sous MacOS 9 et sous les vieilles versions de Windows 95 et 98. Les OS modernes implémentent tous le préemptif.




<Prev in Thread] Current Thread [Next in Thread>