Servlets are based upon multithreading .It can support multiple users requests.Its requests are treated as threads and multiple requests (threads) can access a single instance of servlet.where as CGI creates a new instance for every request it is a single thread model and for every new request it can't support multithreading.
Servlets are effectively a Java version of CGI scripts, which are written in Perl, C, C++, UNIX shell scripts, etc. There are however, a few important differences.
August 26, 2008 at 11:36 AM
The basic concept behind the CGI and Servlets is : CGI is a process based(Heavy weight) and Servlet is a Thread based (Light weight).Insense CGI creates a process for every exceution.So ,this is a time taking process whereas servlet executes by using threadings ,So this is light weight process.Hence Servlets are in more use .