Main loop for rendering and updating logic or spawn new threads

Hi!

I want to know if this approach is correct:

I have the main thread, as always, and currently it does all the work. I want to try and use the 2 cores my computer has (i always relied on one core only for simplicity) so I’m thinking to use the main loop for the calculations and other stuff not related to rendering graphics and spawn a new thread for this.

My Display class (JFrame) uses different states (JPanels) to change levels and menus, so my first idea is to make the state’s superclass extend Thread and every new state I create will spawn a new thread that would run concurrently with the main loop, since there can be only 1 state present, no more than 2 threads would be present at all times.

Do you think this is a good approach?

Another question: If I have two threads, one for each core, do I need to put a sleep in the second thread? I have a sleeping timer for the rendering (main loop) to adjusting the frames so this are constant, but do I need to put the logic thread to sleep even for 1 ms or not?