dcsimg
Efficiency of TaskTimer & threads and general.
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Adam_Zimowski
Posted On:   Sunday, March 12, 2006 04:53 PM

Hello there. My first question: TaskTimer implements Runnable, so it is by definition a thread, correct? Assuming TaskTimer is a thread, how efficient is it from processor's perspective? Let's assume we have a 4 cpu system. If I run a TaskTimer thread, spawned by the main thread, will it use another CPU? How responsive would my main thread by? Also, assuming we have Unix, no matter how many threads I instantiate, I only see a single java process from the operating system's point of view. This seems logical because we don't want to instantiate a whole new JVM just to spawn a thread. But if it is a single process, it goes back to my first question, how efficient use can the OS make of multiple CPUs from a single JVM with many th   More>>

Hello there.

My first question: TaskTimer implements Runnable, so it is by definition a thread, correct?

Assuming TaskTimer is a thread, how efficient is it from processor's perspective? Let's assume we have a 4 cpu system. If I run a TaskTimer thread, spawned by the main thread, will it use another CPU? How responsive would my main thread by?

Also, assuming we have Unix, no matter how many threads I instantiate, I only see a single java process from the operating system's point of view. This seems logical because we don't want to instantiate a whole new JVM just to spawn a thread. But if it is a single process, it goes back to my first question, how efficient use can the OS make of multiple CPUs from a single JVM with many threads?

Sincerely,
Adam

   <<Less

Re: Efficiency of TaskTimer & threads and general.

Posted By:   ankush_purwar  
Posted On:   Tuesday, March 14, 2006 05:12 PM

If one thread is waiting for some I/O operattion other thread may get a chance to run.
So again it's the way to increase the CPU utilization.

Re: Efficiency of TaskTimer & threads and general.

Posted By:   Edward_Harned  
Posted On:   Monday, March 13, 2006 03:51 PM

Java threads map to O/S threads (on most systems.) The O/S selects a cpu for each thread of execution. Therefore, by placing code in separate threads you increase the chance of multi-processing.


The key word is "chance".


What thread runs on any cpu at anytime is nearly impossible to predict. You could end up with so many threads that your code starves. On the other hand, with the proper number of threads, you could have a truly multi-processing application.


How to get from starve to super has driven people crazy (me too) for decades.

About | Sitemap | Contact