google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.

Sunday, May 8, 2016

Transport Layer Protocols

Need of Transport Layer
a. The Internet layer provides unreliable , connectionless service - "best effort" network.
b. The underlying layer (internal layer ) provides the connectionless protocol IP .
c. Datagrams may be lost or reordered .
d. Datagrams can be duplicated or delivered after long delays .
Thus , there is a need for a layer , which takes care of end - to - end delivery.

Features of transport layer
i. True end to end layer .
ii. Takes care of process to process delivery.
iii. Acts as a liaison between the application layer and the underlying internetwork details .
iv. Shields the applications  from  the complexities of the internetwork.
v. Provides a "logical communication " between application processes running on different hosts .

For this purpose ,it performs the following duties:
i. Packetizing : Divides the application data into packets to be sent over the internetwork .
ii. Connection Control : Controls the "logical " connection between applications processes on source and destination hosts .
iii. Addressing: The packets have to be given to the correct application in the destination machine . For this purpose ,the transport layer uses port numbers to identify the application .

Types of Transport Protocols
The end to end applications require transport services of different types.
a. Some applications like file transfer ,remote login,etc. require reliable ,full duplex , data transmission .
b. Applications using client -server communication ,internet  telephony etc. do not need reliable communication but the communication has to be done at high speed.
Hence there are two protocols in the transport layer :
i. Connectionless unreliable service - UDP
ii. Reliable byte -stream service - TCP

i. UDP
User Datagram Protocol
UDP is a connectionless
unreliable protocol.
- No connection is established  between the sender and receiver beforehand.
- "Best effort" i.e. UDP segments may be lost or delivered out of order .
It does not provide flow and error control.
The sender and receiver applications are identified by ports .
It does multiplexing at the source and demultiplexing at the receiver to deliver data segments to the correct application.

Why is UDP used ?
In spite of the fact that is connectionless and unreliable , UDP is used because
i.    It is a very simple protocol.
ii.   Requires minimum overhead.
iii.  Communication is much faster.
iv.   Some applications themselves do flow and error control. For them, UDP is ideal.

UDP Datagram
The various fields of the datagram are as follows:
Source Port Number (16 bits): Port number used by process running on source host.
Destination Port Number (16 bits ) : Port number used by process running  on destination host.
Length (16 bits ) : Total length of datagram.
Checksum (16 bits ): Optional field . Used to detect errors.

UDP Applications:
i.  It is used for one off data transfer applications.
ii.  If a process requires request response communication like DNS ,UDP is used.
iii.  Some processes have internal error and  flow control mechanisms. They can use UDP, which will be faster. Example : Trivial File Transfer Protocol (TFTP).
iv.  Used in multimedia applications where a stream of multimedia data has to be sent from the source to the receiver.
v.   TCP does not support multi casting or broadcasting . Hence ,applications requiring multi casting or broadcasting use UDP.
vi.  Used in router updating protocols for updating router tables
vii. It can also be used for reliable data transfer, if reliability is added at the application layer.
viii.  Used in Network  Management Protocols like SNMP for communication between manager and agent processes .

Saturday, May 7, 2016

Hash Table

If we have a table organization and a search technique which retrieve the key in a single access ,it would be very efficient. To do so, the position of the key in the table should not depend upon the other keys but the location should be calculated on the basis of the key itself .Such an organization and search technique is called hashing .

In hashing the address or location of an identifier X is obtained by using some function f(X) which gives address of X in a table.

HASHING TERMINOLOGY
Hash function :- A function that transforms a key X into a table index is called a hash function.

Hash address:- The address of X computed by the hash function is called the hash address or home address of X.

Hash Table :- The memory available to maintain the symbol table is sequential . This is referred to as hash table .

Bucket :- Each hash table is partitioned into b buckets ht[0]......ht[b-1].
Each bucket is capable of holding 's' records . Thus , a bucket consists of 's' slots. When s=1 , each bucket can hold 1 record.
The function f(X) maps and identifier X into one of the 'b' buckets i.e. from 0 to b-1.

Synonyms :- Usually , the total number of possible values for identifier X is much larger  than the hash table size. Therefore the hash function f(X) must map several identifiers into the same bucket .
Two identifiers I1 and I2 are synonyms  if   f(I1) = f(I2)

Collision :- When two non identical identifiers are mapped into the same bucket , a collision is said to occur , i.e. f(I1)= f(I2). Hence all synonyms occupy the same bucket.

Overflow :- An overflow is said to occur when an identifier gets mapped onto a full bucket.
When s=1 ,i.e. ,a bucket contains only one record ,collision and overflow occur simultaneously . Such a situation is called a Hash clash.

Load factor :- If n is the total number of identifiers in the table and t is the table size , the load factor is : lf = n/t
It represents the fraction of the table that is occupied .

HASHING FUNCTION
A hashing function f transforms an identifier X  into a bucket address in the hash table .The desirable properties of such a function are as follows.
i.  It should be easily computable .
ii. It should minimize the number of collisions .
iii. The hash function should compute the address,which depends on all or most of the characters in the identifier .
iv.  It should yield uniform bucket addresses for random inputs . Such a function is called a uniform hash function.
Several uniform hash functions are in use some of them are
1 Mid Square
2 Division
3 Folding
4 Digit Analysis

अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...