Re: Multitasking in Mac OS Gets 100% CPU
- Posted by mattlewis (admin) Nov 07, 2012
- 1401 views
mattlewis said...
Most of the time is spent in nodelaych() (and really, in a call to tcsetattr), which is how we get keyboard input in non-windows systems. Windows works differently. So perhaps Win7 has a more efficient way of handling console input than XP. Perhaps our implementation of nodelaych() could be improved. Do we really need to call tcsetattr() each time we call get_key()?
I took out the tcsetattr() call in nodelaych(), which changed the profiling, but not the CPU usage. Most time is being spent in the task scheduler() routine, which isn't surprising, since task_yield() was called over 1.5 million times.
In short, I don't think there is really any problem here. A busy loop should produce 100% CPU usage.
Matt