Wednesday, September 10, 2008

Interview Q & A: General Technical Concepts

#1. What is the difference between Process and Thread?

Process is an instance of a program to execute its instructions. Whenever a process is created, process scheduler of the OS will set its status to “wait” and loads the process into main memory from secondary storage like Hard Disk, CD-ROM. After which the process is loaded into the processor (context switching) to execute its instruction moving it to “running” state. During the execution, if the process has to wait for user input or waits for some other resources; it will be moved to “blocked” state. Once process is done with its execution, it is moved to “terminate” state where it will be removed from main memory. For instance, MS Word is a program and its instance can be created to perform documentation.

Threads are basically sub-processes of a process. Each sub-process is termed as a thread executing its own instructions. A process can thus have multiple threads executing in parallel. For instance, MS Word can have multiple threads where one thread can do spell check while other thread might still allow the user to type or arrange document layout.

#2. What is the difference between Multiprocessing, Multitasking, and Multithreading?

Multiprocessing is the ability of a system to support more than one processor and/or ability to allocate tasks between them. For instance a tightly-coupled multiprocessor system contains multiple processors within a single computer system interconnected at the bus level and a loosely-coupled multiprocessor system (also called as clustering) contains multiple standalone computers (with its own processors) interconnected via high speed communication system or local area networks like an Ethernet.

Multitasking is the ability to run more than one program or task at the same time. That is, one process need not wait for other process to finish unlike single-tasking. For instance, you can work on with MS Word simultaneously while browsing or programming.

Multithreading is the ability to execute more than one thread or sub-process in parallel. For instance, MS Word can have multiple threads where one thread can do spell check while other thread might still allow the user to type or arrange document layout.

#3. What is Clustering?

Group of servers that act like a single system or group of computers linked together to achieve high availability/ fail over capabilities and to load balance the application.

#4. What are the different types of Clustering?

Basic types of clustering includes Software clustering and Hardware clustering.

Usually Application clustering is termed as Software clustering where clustering software is installed in each server in the group and uses the software to control the clusters. For instance, creating multiple nodes or multiple instances of server and configuring them in cluster is a good example for software clustering. Also configuring web server installed in one machine to balance the load on different application servers installed in different machines forming a cluster is also another good example for software clustering.

Hardware clustering is one which requires a specialized hardware to control the cluster. For instance, load balance hardware’s like resonators or Cisco load balancing hardware can be used to control the load on each server in the cluster.

#5. What is web syndication and what are the different syndication formats available currently?

Web syndication is a way in which web feeds or web resources made available from one site to other web sites whenever their contents are added or updated. There are two mostly used formats namely Atom and Really Simple Syndication (RSS).

#6. What is in-memory session state replication?

Usually in a clustered environment when a client request is first handled and a session is created by one server in a cluster, the same session may not be available for other servers in cluster. To replicate the session created in one server to all other servers in cluster, we go for in-memory session state replication configuration.

#7. What is the difference between developing Web applications based on CGI and Java Servlet?

Common Gateway Interface (CGI) is a process based model and Java Servlet is a thread based model. That is, for each and every request, in CGI it needs a separate process area whereas in Java Servlet model, only one process area is created and handled with multiple threads.

#8. What is HTTP Tunneling? Give an example implementation of Java based HTTP Tunneling?

HTTP Tunneling is a technique in which communications performed are encapsulated within the HTTP protocol. In other words, creating a sub-protocol or a tunnel inside your HTTP protocol for performing communication between the client-server. In Java HTTP Tunneling is used for Applet-to-Servlet communication where we have a scenario of Java Applet embedded inside a web page residing in client-side of the browser to communicate or pass objects to a Java Servlet residing on server-side.

#9. What is meant by Connection Pool?

Connection pool is a cache of connection objects of the underlying resource maintained in order to reuse them instead of creating it for each and every request for performance improvements. For instance, opening and maintaining a database connection for each user is costly and thus by creating a pool of connection objects the user may not wait to establish a connection to the database.

#10. What are commonly used protocols and their default ports?

HTTP: Hyper Text Transfer Protocol used for processing hyper texts like HTML, normal texts, etc. Default port: 80.
HTTP over SSL: Hyper Text Transfer Protocol used for processing hyper texts over Secure Socket Layer. Default port: 443.
FTP: File Transfer Protocol used for transferring files. Default port: 21.
SMTP: Simple Mail Transfer Protocol used for sending emails. Default port: 25.
IMAP: Internet Message Access Protocol used for retrieving emails. Default port:143
POP: Post Office Protocol used for retrieving emails. Default port: 110.
IIOP: Internet Inter-ORB Protocol used for distributed programs written in different languages to communicate over the internet.

#11. Is HTTP a stateless or stateful protocol? If stateless, how will be the state maintained?

HTTP is a stateless protocol. It does not maintain the state of the client. Only way to maintain the state is to use Http Sessions or Cookies or URL Rewriting or through hidden form fields.

#12. What is a Sandbox in Java? Explain on browser sandbox and server sandbox on Java application?

Sandbox is a security restriction imposed on an application preventing it from actually performing certain functions for specific reason.

Browser sandbox: In case of applets loaded inside a web page, the restriction imposed by the browser on the applet base application to access local file system or any local resources is termed as browser sandbox.

Server sandbox: The restriction imposed by the Web or Application server on a Web application deployed on it in performing its intended function is termed as Server Sandbox. For instance, if we try to use the call System.exit(0) in any of the server-side codes like JSP or Java Servlet then upon accessing this file will not actually terminate and exit the JVM instead results in security exception. Thus this exception was the result of server sandbox of restricting the server-side code in performing its System.exit(0) functionality.

#13 What is the difference between Web Server and Application Server?

Web server serves only web based clients like web browser through HTTP protocol whereas an Application server serves different clients like web browser, standalone java application clients, GUI based java application etc through different protocols. Web server does not manage its own resources in supporting transactions and database connection pooling whereas an Application server manages its own resources including security, transaction processing, resource pooling, and messaging thus supports middleware services.

Its often misunderstood that web servers cannot and only application servers can do load balancing, caching and clustering whereas it can be actually achieved by adopting certain strategies.

#14 Explain about Sticky IP configuration in Clustering?

For applications which does not have the session replication configured, by configuring Sticky IP will assure that the server which handles the first request will handle the other subsequent requests from the same client.

No comments: