Hi all, I have a question about CPU load, task scheduling, and how a real operating system (like Linux/BSD/QNX) manage threads. Q: If you write a simple, single-threaded program in C as follows int main() { while(1); } and run it on a single core CPU, the CPU load shoots up to 1.00 and stays there. Makes sense, as all of the CPU time is spent in this thread. (All as in almost all, since the operating system's task scheduler and other processes have to run as well.) However, many single threaded network event loop libraries, as well as GUI libraries come with their own main loop/event loop. Your program will never exit from the main loop unless you kill it, but while the program is running, the CPU does NOT appear to be under load. What's going on here? How is it that the main loop is running and is responsive, yet the CPU is under minimal load? Even if you did something like this, int main() { while(1) { poll_my_sockets(); do_work(); } } wouldn't it use 100% of the CPU's time in the main loop? But it appears that all asynchronous network libraries somehow don't load up the CPU. Yes, CPU load is the indicator of actual CPU load, and doesn't factor in anything that's waiting on I/O, but shouldn't just the act of calling the poll function in an infinite loop still fully load the CPU? --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .