I have a C++ program that allows a user to single step through processor instructions as a processor simulator emulates a MIPS processor. The problem is that, at least in my testing stages, I need to initialize ~2^32 integers to 0xDEADBEEF. I do this at start-up. It isn’t extremely important that this happens completely before I start “single stepping”. Is it possible for the initialization function to occur in parallel to the rest of the program so that, it will eventually finish but as it progresses I can still single step? How would one do this?
Share
It depends. A separate process means that what happens to its runtime environment has no affect on other processes’ runtime environments. If your initialization needs to affect the runtime environment of the main process, then a separate process would be tricky. A separate thread would be better, as it can affect the runtime environment of the process that started the thread. You can just have the thread run at initialization and do its thing while the rest of the program goes on as normal. This may or may not include the need for semaphores (Or other similar synchronization methods); it depends on whether or not mutual exclusion exists.
In short, yes it’s possible. How you accomplish this though depends on how you do this “single stepping.”