Confusion: How does the transmitter know that his information( bits in physical layer, frames in data link layer, packet in network layer ) was transmitted correctly to the receiver? I know that in the data link layer that is responsible ensuring that frames has been transmitted successfully by sending acknowledgement, but I just get confused on how the three layers communicate with each other on solving this problem.
I know that in the data link layer that is responsible ensuring that frames has been transmitted successfully by sending acknowledgement
That is incorrect. There are very few data-link protocols that do this. The transport protocol is normally where acknowledgement takes place, but not all transport protocols do that. TCP does, but UDP does not. With a connectionless transport protocol, it is up to the application to do that.
The protocols in the different layers don't really know about each other. There are fields in a protocol header (e.g. EtherType for ethernet, or Protocol for IPv4) that tell a protocol to which process it should send the payload of its protocol.
This cannot be answered easily.
An application can ensure delivery by itself or rely on the transport protocol to handle that. Network-layer and below protocols usually only ensure integrity (by checksums) but don't guarantee delivery - with some exceptions like 802.11.
If you will look at the layer 2 frame, you will see that there is a field FCS(Frame Check Sequence). While sending the frame to the other end, a mathematical algorithm CRC(Cyclic Redundancy Check) is performed on the frame which comes up with a number and that number is stored in the FCS field of frame. When the frame is received at the other end, the same algorithm is performed again. And again that mathematical algorithm comes up with a number.
Then both the numbers obtained(before transmission and after receiving) are compared. If they both comes out to be equal, that means data is safe and no data corruption has occurred. But if both are not equal, that means data corruption has occurred and consequently, the other end drops that frame.
Only some layer-2 protocols have an FCS. The entire world doesn't run on ethernet; there are many layer-2 protocols.– Ron Maupin ♦Mar 25, 2018 at 6:50