I've never done any CGI stuff before, but can't you employ some kind of messaging mechanism with an already running process? Maybe use memory-mapped files or some other technique to communicate with the process?