I want to make a demonstration of the ideal event loop, that I will include in the OS 9.3 SDK.
Problem 1: using as little CPU time as possible when no thread is running. Some programs like MacLoad and Process Spy use very little CPU time. How would they do it?
Problem 2: using as much CPU time as possible when a thread is running, but no more than necessary, for example reading a file and calculating a CRC. Here I do several things at the same time: I process events, I process data, I wait for asynchronous calls to complete and I switch threads.