Re: Multitasking in Mac OS Gets 100% CPU

new topic     » goto parent     » topic index » view thread      » older message » newer message
bryanso said...

Hi Matt,

The simplest case is the multitasking example in mini guide http://openeuphoria.org/docs/tasking.html#_645_multitaskingineuphoria
When it is run in Mac OS Mountain Lion, EU 4.0.4, the cpu goes up to 100% during the entire execution.

I don't believe this is expected as it doesn't have the same problem in Windows 7.

I get this behavior on Linux. I would expect Windows to show the same thing. Most of the time is spent in the while loop:

while t1_running or t2_running do 
	if get_key() = 'q' then 
		exit 
	end if 
	task_yield() 
end while 

The other tasks don't run very often, so control returns here. When you yield here, control typically comes right back, because the other tasks aren't ready to run yet.

I tried this in WinXP, and I think it's actually using all of the CPU there, but some of it is reported for csrss.exe. The multitasking on Windows is implemented with Fibers, and I think that Fiber related activity shows up under csrss.exe. The CPU is definitely pegged while the program is running.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu