[Tutor] Re: how do I sleep?

alan.gauld@bt.com alan.gauld@bt.com
Thu, 29 Nov 2001 10:43:32 -0000


> >NT, but a decent kernel will perform the time-slicing between
> >processes on its own.
> 
> I'm sure you know enough about NT to know it's an indecent kernel :)

True, although W2K and XP are much better IMHO.

But even NT has proper pre-emptive multi tasking. There is no need 
to yield control as there is on Win3 and to a lesser extent in 
Win9x.

Even in VB on NT there is no need to yield the CPU will get 
its time slice without any work from you.



> Anyway, there must be a way to give control to the NT 
> otherwise it would be unusable a serious Python program 
> in NT 

Not so the OS schedulling is perfectly adequate.

You can call the Windows APIU in NT to do this but its just a stub. 
It doesn't actually do anything, its simply there for 
compatibility with other Windows OS's. Of course if your program 
does want to run on Win3/9 then thats another problem. But even 
then, since most Python programs are batch orioemnted rather 
than GUI/Event driven they don't yield anyway - its only 
when processing Windows Events that VB programms yield control.

You could of course write it in Tkinter or wxPython which then 
allows the event handling scheduller to kick in. But on NT its 
all unnecessary.

Alan g.