difference between Servlet and CGI
-
no difference
-
servlet runs slowly than CGI
-
CGI is a complex process , servlet is easier ie lieght weight component
-
none of these
CGI creates a new process for each request, making it resource-intensive and slower. Servlets run in a single JVM instance and use threading, making them lightweight and more efficient. Option C correctly captures this key architectural difference.
CGI spawns a new operating system process for every request, which is comparatively heavyweight and slow, and each script must handle its own setup on every invocation. A Servlet, by contrast, runs within the web server's JVM as a lightweight thread and its class stays loaded in memory across requests, making it a simpler and more efficient model than the CGI process-per-request approach.