Are there any approaches to simulate coroutines in a single thread environment or approaches to deal with multiple processes within one process?