On Sun, Apr 30, 2017 at 10:11 PM, <raffaello.giulie...@lifeware.ch> wrote:
> Hi, > > I can't find a description on how ProcessorScheduler in Pharo (i.e., > Cog) is supposed to do context switches in absence of other > synchronization points. > > Is it following the BlueBook spec? Just to recall that model, the VM, > when about to execute the current bytecode instruction of the current > Process, checks whether a strictly higher priority Process is ready to > run and if so, switches to (one of) the highest priority among them. > > Thanks in advance for clarifications. > > This topic is probably a bit advanced pharo-users list. You'll likely get better answers in vm-dev list of pharo-dev list. Can you post any follow ups there? ProcessScheduler doesn't have much to do with context switching, except providing the #yield primitive for a user to invoke manually. As you noted, the actual context switching happens in the VM. The charts here [1] might be useful to get an overview of the execution loop. Keep in mind though Its a very rough view of a novice exploring the Cog execution engine and may not be entirely accurate. But it will give you a starting point. For another example, look at CoInterpreterPrimitives>>primitiveEnterCriticalSection in VMMaker (http://source.squeak.org/VMMaker). cheers -ben