title: What does -Xss JVM option actually do
body: <p>From the documentation, -Xss is used to set the stack size of JVM. But I am very confused about this statement.</p>
  
  <p>In Java, every thread has its own stack. Does the number specified by -Xss:</p>
  
  <ol>
  <li><p>The total memory that can be used as stack by all threads? e.g. If -Xss is set to 256K, all the threads will create their own stack within this 256K of memory.</p></li>
  <li><p>The size of each stack of a thread. e.g. If -Xss is set to 256K, each thread will have a stack of 256K big. Hence 10 thread will use 2560K altogether.</p></li>
  </ol>
  
  <p>Thank you very much.</p>
  
  <p>EDIT: </p>
  
  <p>Thanks for your answers. It looks like it is the (2) senario above. -Xss specifies the largest stack size of a particular thread.</p>
  
  <p>Then I have a follow up question: Where will these memory be allocated on?</p>
  
  <p>We can specify the reserved heap memory using -Xmx and -Xms. Will stack be allocated using these reserved memory? Or it is allocated from the native memory directly?</p>