site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Importance: Normal User-agent: SquirrelMail/1.4.15 On Fri, September 17, 2010, David Wu wrote:
I'm a developer working on a multi-media application on Mac OS X. Our application is designed to run on all Mac PC/laptop including Mac Mini, iMac, MacBook, MacBook Pro, MacBook Air. Now we have a problem on testing our application on MacBook Air. When the application runs about 20-30 minutes, the idle CPU usage decreases to 0%. When I open the Active Monitor, I find the kernel_task consumes very high CPU usage, even higher than 100%. This causes the CPU resources for our application not enough to handle the multi-media tasks.
The kernel task is not a real task. It represents the kernel, which is the core of the operating system. The bulk of what it does occurs at the direct request of an application. Every time you allocate a large block of memory, open or close a file, read or write a file, pull data over the network, create a new process or thread, etc., your application performs a system call. These calls cause the kernel to do work for your application. Much of that work is billed to the kernel task, but it really is being done by your application, albeit indirectly. My advice would be to take advantage of the performance profiling tools in Instruments to find out which system calls your application is spending a lot of time doing, then find ways to reduce the number of times you call them. For example, read data from disk in larger chunks. Reuse large memory allocations instead of releasing them and re-allocating them. And so on. Start by reading these two docs: http://developer.apple.com/library/mac/#documentation/Performance/Conceptual... http://developer.apple.com/library/mac/#documentation/DeveloperTools/Concept... and go from there. David _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com