Close Menu
  • Analog Design
    • Latest Analog Layout Interview Questions (2025)
  • Digital Design
    • Digital Electronics Interview Question(2025)
    • Top VLSI Interview Questions
  • Physical Design
    • Physical Design Interview Questions for VLSI Engineers
  • Verilog
    • Verilog Interview Questions(2024)
  • Forum
Facebook Instagram YouTube LinkedIn WhatsApp
SiliconvlsiSiliconvlsi
Forum Questions Register in Forum Login in Forum
Facebook Instagram YouTube LinkedIn WhatsApp
  • Analog Design
    • Latest Analog Layout Interview Questions (2025)
  • Digital Design
    • Digital Electronics Interview Question(2025)
    • Top VLSI Interview Questions
  • Physical Design
    • Physical Design Interview Questions for VLSI Engineers
  • Verilog
    • Verilog Interview Questions(2024)
  • Forum
SiliconvlsiSiliconvlsi
Home»Difference between Java Servlet and CGI

Difference between Java Servlet and CGI

Difference between Java Servlet and CGI

A Servlet is a Java class that extends the capabilities of servers hosting applications accessed through a request-response model. Web servers primarily utilize servlets to extend hosted applications.

The Common Gateway Interface (CGI) serves as middleware between WWW servers and external databases and information sources. The World Wide Web Consortium (W3C) defined the Common Gateway Interface (CGI) and also defined how a program interacts with an HTTP server.

Java Servlet

  • Servlets are thread-based, meaning that for every new request, a new thread is created.
  • Servlet codes are written in the Java programming language.
  • Since servlets are written in Java, they are object-oriented, providing the benefits of object-oriented programming (OOPs).
  • Servlets are portable, meaning they can be used on different systems or platforms.
  • Servlets remain in memory until explicitly destroyed.
  • Servlets can be used with any web server that supports them.
  • Servlets allow data sharing between components.
  • Servlets link directly to the server.
  • Servlets can read and set HTTP servers.
  • The construction and destruction of new threads in servlets are not costly.
  • Servlets may have a slower speed compared to other approaches.
  • Servlets can be platform-independent.

Common Gateway Interface (CGI)

  • CGI is process-based, meaning that for every new request, a new process is created.
  • CGI codes can be written in any programming language.
  • Since CGI codes can be written in any language, not all languages are object-oriented like Java, so the user may not receive the benefits of object-oriented programming.
  • CGI is not portable, meaning it may not work on different systems or platforms.
  • CGI is removed from memory after the completion of the process-based request.
  • CGI can only be used with web servers that support it.
  • Data sharing is not possible with CGI.
  • CGI does not link the web server directly to the server.
  • CGI cannot read or set HTTP servers.
  • The construction and destruction of new processes in CGI can be costly.
  • CGI generally has a faster speed compared to other approaches.
  • CGI can be platform-dependent

 

Facebook X (Twitter) Instagram Pinterest Vimeo YouTube
  • About Us
  • Contact Us
  • Privacy Policy
© 2025 Siliconvlsi.

Type above and press Enter to search. Press Esc to cancel.