separating the gen routine into a different process, use OS's preemptive scheduling to avoid long response time when phantom is working