Wednesday, 29 February 2012

Define DNS?



The Domain Name System (DNS) is a hierarchical naming system built on a distributed database for computers, services, or any resource connected to the Internet or a private network. DNS is an Internet service that translates domain names into IP addresses.

Define TCP/IP?



TCP (Transmission Control Protocol) is a reliable, point-to-point, connection-oriented, full-duplex protocol.

Define UDP?



UDP (User Datagram Protocol) is a connectionless unreliable transport protocol. It extends IP’s host-to-host delivery service to process-to-process communication service.

Multitasking vs Multithreading:



·        Process is nothing but the program that is executing.
·        Process based multitasking (or) multitasking is the feature that allows the system to run two or more programs concurrently.
·        Example for multitasking: This multitasking enables us to use the java compiler at the same time when we are using text editor.
·        Threads are separate tasks running within a program.
·        In Thread-based multitasking (or) Multithreading, a single program can execute two or more tasks simultaneously.
·        Example for multithreading: a text editor can format the text at the same time that it is printing.
·        In multitasking, a program is the smallest unit of code that can be dispatched by the scheduler.
·        In multithreading, the thread is the smallest unit of code that can be dispatched by the thread scheduler.
·        The processes in multitasking (process-based multitasking), are referred to as heavyweight tasks. Since,
o   Each process requires its own separate address space.
o   Context switching from one process to another is CPU-intensive task needing more time.
o   Inter-process communication between the processes is again expensive (as the communication mechanism has to span separate
·        Multitasking threads cost less in terms of processor overhead (or) simply Multitasking threads requires less overhead than multitasking processes because of the following reasons:
o   Multiple threads in a program share the same address space, and cooperatively share the same heavyweight process.
o   Context switching from one thread to another is less CPU intensive.
o   Inter-thread communication, is less expensive (as threads in the program communicate in the same address space).
·        Multithreading are used to write very efficient programs that make maximum use of CPU, because idle time of the CPU can be kept down to a minimum.
·        This is really important for the interactive and networked internet environments.
Eg:-
    There may be an instruction in a program that is reading a file from a different host on the network. Knowing that reading from a local file system itself is slow compared to the speed of the CPU, reading from a file on a different host on the network is an even slower process. In single threaded environment, the rest of the program waits till the I/O instruction returns. Once the CPU dispatches the I/O instruction it is free. This idle time of the CPU should be put to good use by executing some other part of the system.

Multitasking:




·        The process of executing several programs simultaneously is known as multitasking.
·        Multitasking is further classified as:
o   Process-based multitasking
o   Thread –based multitasking
·        Process-based multitasking usually referred to as multitasking whereas thread-based multitasking is referred as multithreading.

Multithreaded Programming


·        A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread.
·        Threads are separate tasks running within a program.

Need for Multithreading:
·        Have you faced the following situations?
o   The browser cannot skip to the next web page because it is downloading a file?
o   You cannot enter text into your current document until your word processor completes the task of saving the document to disk.
·        If the program consists of a single thread, it can handle only one activity at a time, which results in the above situations.
·        To handle such situations effectively, multithreaded programming has been developed.

Exception Handling in JAVA:



·        In Java, exception handling is managed via five keywords:
o    Try
o    Catch
o    Throw
o    Throws
o    finally
·        Program statements that should be monitored for exceptions are contained within a try block.
·        If an exception occurs within the try block, it is thrown. The exception which is thrown should be caught by the code (using catch) and that should also be handled.
·        System-generated exceptions are automatically thrown by the Java run-time system. To manually throw an exception, use the keyword throw.
·        Any exception that is thrown out of a method must be specified as such by a throws clause.
·         Any code that absolutely must be executed before a method returns is put in a finally block.

This is the general form of an exception-handling block:

try
{
// block of code to monitor for errors
}
catch (ExceptionType1 exOb)
{
// exception handler for ExceptionType1
}
catch (ExceptionType2 exOb)
{
// exception handler for ExceptionType2
}
// ...
finally
{
// block of code to be executed before try block ends
}

·        Exception Type is the type of exception that has occurred.

IE7 Issues Text Indent

                 Unfortunately IE 7 is still widespread among the users hence while theming we have to give special importance to the grea...