As we know that servlet have no main() method so servlet need help to invoke the servlet. So another program invoke servlet for processing request of user.
So, when first request comes tomcat load servlet into container and load to servlet. Now container create thread for one request. Now at that time if another request comes container user that loaded servlet and create another thread for handle that new request. So container create new thread for each request and not create and load new servlet instance.
Now about thread safe i think servlets are not thread safe only instance variable of servlet are thread safe.
Thank you Nishan for sharing your knowledge with me.
I am agree with you that only one instance will get created in servlet container but still i need answer of my question that how container create threads of servlet and what method or instance has been shared beetween threads.
And about thread safe - we can make servlet thread save by implementing SingleThreadModel interface but how it handle internally ...i don't know...So Ranchers please help me and solve my confusion.
about SingleThreadedModel markup interface, How it makes servlet thread safe.
It doesn't. By implementing that interface the developer is telling the servlet container "this servlet is NOT thread-safe", so that the container will only run this servlet in a single thread at any given time. But that is not sufficient to make the web app thread-safe (there are other ways of making it thread-unsafe besides running a particular servlets in multiple threads simultaneously).