What core is my app running on

I have to do a lot of complex processing on XML files that are >8 GB in size with millions of “records.” I know to use XMLReader rather than XMLDocument, but in addition to that what I’d like to do is split up the file into smaller chunks and allocate it to multiple instances of my app (this is on Linux servers). My code is not threaded, as everything is pretty sequential and there’s no UI.

My question is: on a machine with multiple cores, is there any way to guarantee that different instances of the app will run on different cores? Is there any way for the app to even know what core it’s on? If I’m trying to achieve parallelism, having multiple copies of the app on different cores would seem to be the best approach, but I don’t know if I can even control that.

I can always spin up another machine, but I’d like to try it this way first.

Thanks!

Start another instance of the app and just let the os take care of it and don’t bother with threads in xojo.

Yes, of course that’s what I’m doing. But I’d like to put in some instrumentation so I can see what’s going on.

With 4 instances on 4 cores it can be that they still wait on disk I/O, so performance may not be 4x.

Top or ps off the top of my head with the right params. Exec them from inside xojo and parse the output?

There’s probably a nice Linux system call but I can’t check atm as I’m afk.

@Christian Schmitz : yes, I thought about that, so I would have them outputting to 4 different SSDs. There’s still some OS i/o overhead, but at least I wouldn’t have the physical i/o collisions.

@JulianS : good idea, I’ll look into those calls.

Here you go:

http://stackoverflow.com/questions/8032372/how-can-i-see-which-cpu-core-a-thread-is-running-in

taskset - set or retrieve a process’s CPU affinity should be helpful.