> I have 2 threads and need to assign them to run on
> seperate CPU. Is there any way to do it?
>
> Thanks.
? What does that mean? Do you have a multicore machine? If so then what difference does it make which core a thread runs on? If you're trying to make sure a certain thread executes to completion before another one, then don't use threads. The whole point of threads is that they let different "threads" of execution happen concurrently. They aren't designed to be run in sequence.
> > I have 2 threads and need to assign them to run on
> > seperate CPU. Is there any way to do it?
> >
> > Thanks.
>
> ? What does that mean? Do you have a multicore
> machine? If so then what difference does it make
> which core a thread runs on? If you're trying to make
> sure a certain thread executes to completion before
> another one, then don't use threads. The whole point
> of threads is that they let different "threads" of
> execution happen concurrently. They aren't designed
> to be run in sequence.
I want to bind a thread to a specific CPU. In C++, there is API can do it. My question is whether there is similar API in Java?
thanks .
> I want to bind a thread to a specific CPU.
That doesn't answer my question. Do you have more than one processor on that machine?
> In C++,
> there is API can do it. My question is whether there
> is similar API in Java?
No, java threads can't be scheduled relative to other threads, and there's certainly no way to specify which hardware to run it on. One of the major benefits of java is that it abstracts the hardware away from you. What are you actually trying to accomplish with all of this?
> thanks .