Q:

Multithreaded application in a multicore processor

This is a somewhat generic question. Suppose that I am creating a simple application in Java or VC++ which creates two threads and I run the application in a multicore system. Without any specific directive for which core to run, will the application itself will distribute the threads across various cores?
Thanks.

A:

The application will not distribute the threads, but the OS will.  That's its job.  :)
It's interesting to note that threads can swap between cores quite frequently in the course of a single running process due to other loads and interrupts that can hit a cpu core.
If you decide that you need specify the core that a particular thread can run on, the OS will generally provide a mechanism set the thread's "affinity" to a specific cpu.  This may be valuable in advanced optimization scenarios to keep a particular thread's cache hot, e.g.  It's generally not needed, though.  

A:

The OS assigns processes and threads to different cores. That is not to say you cannot influence the decision, some OSs allow you some control on deciding this. Processes may also move between cores as necessary to ensure good utilisation of cores.

