Date: Tue, 17 Nov 1998 22:21:25 -0500 (EST) From: Alex Boisvert <alex@gel.usherb.ca> To: Gunther Schadow <gunther@aurora.rg.iupui.edu> Cc: freebsd-java@FreeBSD.ORG Subject: Re: green threads vs. native threads ... Message-ID: <Pine.BSF.3.95q.981117220805.1530J-100000@teel.info-noire.com> In-Reply-To: <199811132244.RAA14641@aurora.rg.iupui.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 13 Nov 1998, Gunther Schadow wrote: [snip] > However, as it turned out, both threads are still waiting on each > other and, most of the time, the threads seem to execute sequentially > rather than parallel. [snip] > > w**********.*..*..*..*..*..*..*..*..*..w > > But look at the rest: ****************************** > *********************................................................. > ..w**************************...************************************** > .*.*.***************************************************************** > ***r.................................********************************* > r..................................................................... > ...........................................................w********** [snip] > ..........w********************************************............... > ............................. > > It seems like the two threads do no longer run in parallel. As you said, FreeBSD's JDK uses green threads. Green threads run at the user-level, not at the system-level. Which means that they don't "schedule" the same way as all the other (native) processes in your machine. With our JDK, you have to explicitly specify a 'timeslice' to make sure that your processor time is shared among each Java thread. To do this, you have to supply a command-line parameter to the VM, like this: java -ts100 YourMainClass This will give each thread 100 miliseconds of execution time before being preempted by another thread (context switch). Of course, threads can block and yield some of their allocated timeslice. Without this timeslicing concept enabled, your threads run as long as they don't block, which explains why you were seeing many dots "." and many asterisks "*" in a row. Give it a try... Alex. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.981117220805.1530J-100000>