This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: why I was seeing exceptions thrown across threads -- a detailed explanation


Adam Megacz wrote:

>Tom Tromey <tromey@redhat.com> writes:
>
>>Adam> Interesting. If it was cooperatively multitasked, did you have
>>Adam> to hack GCC to insert a yield() after every instruction?
>>
>
>>No.  Java doesn't require preemptive multithreading (and even if it
>>did, at the time we didn't care).  We task switched on mutex and
>>condition variable operations, and maybe a couple other places.
>>
>
>Woah, so what happens if I spawn two threads and put one of them into
>an infinite loop? Would the other one get starved?
>
In theory, Yes.
The programmer has to insert yield() calls from time to time in such 
java code.
Cedric



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]