"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.
|