• Post Reply Bookmark Topic Watch Topic
  • New Topic

jvm  RSS feed

 
c shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is every instance of jvm a heavy-weight process?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you provide more details about your question?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseAMeaningfulSubjectLine. I saw two of your threads, both with subject "jvm", and my first thought was that these were duplicates of each other. If your subject lines are more descriptive you'll find that not only I will not be confused like this, but also that others will recognize what the thread is about and help you sooner.
 
c shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am preparing for scwcd.I was in the first chapter reading the difference between CGI and Servlets.Servlet guy said that "with pearl,server has to launch a heavy-weight process for each and every request for the resource" then CGI guy said that this is no different from java.Is not every instance of the jvm a heavy-weight process?In reply to this Servlet guy said that servlets stay loaded and client request for a servlet resource are handled as separate threads for a single running servlet.There is no overhead of starting the jvm,loading the class....

Can you please elaborate on this?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With CGI, it works like this: Web server receives an HTTP request and finds out that it needs to be handled by a CGI program. It has to start up the program, which will start a new process on the server. The program handles the request, sends the result back to the web server and ends. For every HTTP request, the server has to start up the program again. Starting a new process is a relatively heavyweight operation on most operating systems: the OS has to load the program, then it has to prepare some memory space and other things for the process before it can start running. If the server has to handle lots of HTTP requests in a short amount of time, the overhead of starting a program for each request can become a problem.

With Java servlets, the servlet is a Java class that just stays loaded in memory in a Java EE application server. The app server receives a request and passes it immediately to the servlet - the servlet does not have to be loaded for every request.

The CGI guy was wrong.

Yes, the JVM is a process just like any other program, however when using servlets, it only has to start up once, and not for every request.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!