dcsimg
Multithreading
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, February 26, 2002 05:13 PM

Please tell me if there is a method that allows me to run two threads at the same time. Multithreading is about running a thread at a very short time, thus concurrency of two threads is only the illusion of the users. We as a programmer know that there is switch of processor time between these threads, but the switch is so short that the users do not notice it. I need to make my program runs in a way that these threads are running simultaneously, one the front and the other at the backend without switching of processor time.

Re: Multithreading

Posted By:   Simon_Ablett  
Posted On:   Tuesday, March 5, 2002 06:31 AM

On a single processor machine there's no way to run two processes simultaneously without the processor time slicing between them (ok, with newer technology this might not be strictly true!!). Even if you didn't use threads there would still be the switching between processes and if you only ran one process the operating system will still grab cycles from you for its own requirements. What is it that you are hoping to achieve that makes you think that time slicing will cause you problems? If your app is likely to be so timing-sensitive you would probably be best using a realtime operating system and developing directly in machine code or such like.

Regards.

Re: Multithreading

Posted By:   Anonymous  
Posted On:   Sunday, March 3, 2002 03:38 AM

The behaviour you descibe is due to the fact that the machine has only one processor. If you run on a mutli-processor machine, multiple threads can really run conncurrently.


However, on a single-CPU machine, is is inpossible to run two threads _really_ simultaneously.


Hope this helps.


Regards,

G√ľnther
http://www.javacoding.net

About | Sitemap | Contact