Peddireddy Srikanth wrote:

 1) what is the default stack size for Sun JVM on windows (Win 2003
to be more specefic)??
Dont know.

 2) Will this setting affect both normal threads and the servlet
threads created by tomcat?? or only normal threads?
I believe there is a 1:1 corelation between all Java application threads, be they Servlet or normal threads. That is to say a Servlet thread uses exactly 1 Java thread.

3) If I set that to, say 128K , and if some of my thread (servlet or normal) needed more stack space than this in any case what happens
(obvious answer for this would be that thread execution would fail but
I want to know it from some one who experienced it)
Are you able to change the stack size on a per Java Thread basis?

If the underlying JVM uses kernel level threads and stack arrangement in a 1:1 fashion (unlikely from the observations I've seen), an unmapped page/area is usualy left at the end of the stack space if this is touched (read or write) the application will get a terminal signal and the entire JVM forced to exit just like it would accessing any other bit of invalid memory.

However as JVM is a sandbox and it can know the amount of stack space a method needs before its invoked it is completely possible for it to be able to check/test its virtual Java stack has enough space left in the CPU instruction stack as there does not need to be 1:1 to the Java execution stack. Its possible for a JVM to implement its Java code execution stack completely within the operating system heap area.

I dont believe Java in general needs a large java execution stack as all arrays are implemented as object allocations that come from the heap. So its not like the C language where you can have a few Kb byte array on a whim, in Java it just has to store the pointers to that array as a local variable in the java execution stack.


I would be very interested to understand how Sun's JVM application stack works and its interactions with OS level threads, stacks and address space applications.

With platform level threads there is a clear trade off with thread stack size and number of available threads, amount of available heap and number of library / file mappings (when working with 32bit CPUs at least). They all squeeze each other for their bit of address space but in Java this does not seem to be the case so much.

-- Darryl L. Miles



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to