It sounds like this may be a good place to use
merlyn's method that he wrote up in his
"search in progress" WebTechniques article.
It is a good explination of how to get a request, fork a process to do your heavy work, redirect the browser to a status file that the kid updates until it's done with its slave labor.