Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Advanced-java] Multithreading problem.
- From: rana@xxxxxxxxxxxxxx (Hemendra Rana)
- Subject: [Advanced-java] Multithreading problem.
- Date: Wed, 28 Feb 2001 10:49:29 -0500
It might not be round robin. I am not sure how scheduling works so while programming I always assume that some random thread is going to be scheduled. Rogelio Perez wrote: > Thanks Hemendra, all of my threads are waiting to read in a socket, it could > be the I/O operation > you say. > But in my machine I could spawn more than 999 threads, I don´t know the > Solaris lwp limits? > > Also I´ve seen that sometimes one thread recently created can be scheduled > before others waiting to be scheduled, Any idea?. Sometimes one thread waits > about 5 seconds because new threads are been continously started?. This > happen when all of them are waiting to entry in an object monitor. (I don´t > understand why, --> round roubin?) > > Thanks in advance. > > ----- Original Message ----- > > From: "Hemendra Rana" <rana@xxxxxxxxxxxxxx> > To: "Rogelio Perez" <rogeliop@xxxxxxxx> > Cc: "Peter Humphries" <Peter.Humphries@xxxxxxxx>; > <advanced-java@xxxxxxxxxxxxxxxxxxxxxx>; "Hemendra Rana" > <rana@xxxxxxxxxxxxxx> > Sent: Wednesday, February 28, 2001 4:12 PM > Subject: Re: [Advanced-java] Multithreading problem. > > You are right in the way that each LWP executes exactly one thread at any > given > moment and it would not perform any timeslicing among the eligible threads > until > ofcourse it finds a higher priority thread. In native threads model, the JVM > thread scheduling is more or less controlled by LWP scheduling done by the > OS. > So when the LWP gets scheduled to run, it picks up the highest priority JVM > thread from the pool of JVM threads waiting to be scheduled. The LWP > eventually > loses its timeslice and another LWP gets scheduled by the OS. The LWP that > got > scheduled now, would look for the highest priority JVM thread waiting to be > scheduled and would run that thread. When an LWP is scheduled out by the OS > to > make way for another LWP, it deposits the JVM thread that was associated > with it > into the pool of thread that is waiting to be scheduled. > > In case when there are more then one threads of equal priority, waiting in > the > pool of JVM threads to be scheduled, the thread that needs to be associated > to > the LWP may be chosen in round robin fashion. > > The exceptional case occurs when the JVM thread blocks for an I/O. In this > particular case, the LWP gets stuck with the JVM thread, until the I/O is > complete. If all the LWPs in the system are stuck for I/O and there are > threads > in the pool of JVM threads to be scheduled, the OS assigns a new LWP to the > JVM > that then works just like any other LWP. > > Chapter 6 of Java Threads by Scott Oaks & Henry Wong (2nd Edition), > describes > how java native threads model works on Solaris. So a JVM might create N > threads, > but that does not necessarily mean that there are going to be N LWPs. There > will > be M LWPs in the system where M <= N. If all the LWPs are not involved in > I/O > then M < N and M = N only when all the JVM threads are are blocked for I/O. > > Please correct me if I am wrong. > > Hemendra > > Rogelio Perez wrote: > > > but when I execute ps -eLc I could see that 6000 lwp appear in my java > > process.??? > > > > Also I´m running my program with java -xss 60k, this option causes a minor > > memory consume per thread. > > > > ----- Original Message ----- > > From: "Hemendra Rana" <rana@xxxxxxxxxxxxxx> > > To: "Peter Humphries" <Peter.Humphries@xxxxxxxx> > > Cc: <advanced-java@xxxxxxxxxxxxxxxxxxxxxx> > > Sent: Tuesday, February 27, 2001 7:56 PM > > Subject: Re: [Advanced-java] Multithreading problem. > > > > > It is an incorrect assumption. > > > > > > Peter Humphries wrote: > > > > > > > I assumed that with the "-native" option there would be a native > thread > > (or > > > > light-weight process in Solaris speak) per Java thread. Is that an > > incorrect > > > > assumption? > > > > > > > > Peter H > > > > Jyra Research Ltd > > > > > > > > ----- Original Message ----- > > > > From: "Hemendra Rana" <rana@xxxxxxxxxxxxxx> > > > > To: "Peter Humphries" <Peter.Humphries@xxxxxxxx> > > > > Cc: <advanced-java@xxxxxxxxxxxxxxxxxxxxxx> > > > > Sent: 27 February 2001 18:37 > > > > Subject: Re: [Advanced-java] Multithreading problem. > > > > > > > > > The stack address space that you are talking about is the LWP stack > I > > > > suppose > > > > > and not the JVM thread. He has 6000 threads doesn't mean he has 6000 > > lwps. > > > > > > > > > > Peter Humphries wrote: > > > > > > > > > > > I'm astonished you can get up to 6000 threads at all. I would have > > > > thought > > > > > > the stack address space requirements would have blown the (2^32?) > > limit > > > > well > > > > > > before then. Did you have to tweak any settings to get that far? > > > > > > > > > > > > Peter H > > > > > > Jyra Research Ltd > > > > > > > > > > > > > -----Original Message----- > > > > > > > From: Rogelio Perez <rogeliop@xxxxxxxx> > > > > > > > To: advanced-java@xxxxxxxxxxxxxxxxxxxxxx > > > > > > > <advanced-java@xxxxxxxxxxxxxxxxxxxxxx> > > > > > > > Date: Tuesday, February 27, 2001 12:15 PM > > > > > > > Subject: [Advanced-java] Multithreading problem. > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > I´m working with Java 1.2.2.006 in Solaris 2.7, Sparc Ultra 250, > 1 > > Gb > > > > of > > > > > > > memory. > > > > > > > My program spawns over 6000 threads. Then I observe that new > > threads > > > > over > > > > > > > this number are created more slowly. > > > > > > > > > > > > > > I run the program with this command line "java - native > myprogram" > > > > > > > (native threads) > > > > > > > > > > > > > > Does anybody know any limitation in the JVM about number of > > threads > > > > that > > > > > > can > > > > > > > be executed simoultaneously without performance problems. > > > > > > > > > > > > > > Any idea. > > > > > > > Thanks in advance. > > > > > > > > _______________________________________________ > > > > Advanced-java mailing list > > > > Advanced-java@xxxxxxxxxxxxxxxxxxxxxx > > > > http://lists.xcf.berkeley.edu/mailman/listinfo/advanced-java > > > > > > _______________________________________________ > > > Advanced-java mailing list > > > Advanced-java@xxxxxxxxxxxxxxxxxxxxxx > > > http://lists.xcf.berkeley.edu/mailman/listinfo/advanced-java
- References:
- [Advanced-java] Multithreading problem.
- From: <wkoscho@xxxxxxxxxxxx (Bill Koscho)
- [Advanced-java] Multithreading problem.
- From: Peter Humphries
- [Advanced-java] Multithreading problem.
- From: Hemendra Rana
- [Advanced-java] Multithreading problem.
- From: Peter Humphries
- [Advanced-java] Multithreading problem.
- From: Hemendra Rana
- [Advanced-java] Multithreading problem.
- From: Rogelio Perez
- [Advanced-java] Multithreading problem.
- From: Hemendra Rana
- [Advanced-java] Multithreading problem.
- From: Rogelio Perez
- [Advanced-java] Multithreading problem.
- Prev by Date: [Advanced-java] Multithreading problem.
- Next by Date: [Advanced-java] reading a double into a txt file
- Previous by thread: [Advanced-java] Multithreading problem.
- Next by thread: [Advanced-java] Deploying JRE for Client
- Index(es):