menu
  • БЪЛГАРСКИ
  • News
  • Articles
  • Projects
  • Downloads
  • Аbout
  • Donation
  • last edited on: 2017-10-17

    Asynchronous vs Synchronous Communication

     

    The aim of this article is not to analyse the subject in depth but to give a general idea of the differences between asynchronous and synchronous communication. These are terms which I use in various articles on the website and here you can find clarification on what I mean.

     

    Asynchronous Communication

    Asynchronous communication can be defined as a way of exchanging data between two or more devices which are not simultaneously involved in the communication and a synchronising mechanism (such as a clock), which determines who and when can send or receive a message, is not used. This is a two-way communication system in which there is a delay between sending and receiving messages. Participants in it read and send messages at a time convenient for them, i.e there’s a difference in the time of arrival of a message and the time of sending a reply to that received message.

     

    General characteristics:

    • Devices do not wait for the other side’s response to send the next command or message(data);
    • Communication between devices can be temporally drawn out and disorganized;
    • The reply to a given message doesn’t necessarily come right after the message is received;
    • Who the initiator of the information exchange will be is not determined in advance;

     

    Some examples:

    • The majority of communication between the main components of computers (between the CPU and RAM memory and between the CPU and hard drive);
    • Communication between the computer and peripheral devices (modems, printers etc) is asynchronous;
    • The exchange of messages between computers in a network, when it is not necessary for all the participants to be online (in most cases there’s only one active participant in the exchange and that’s the sender);
    • Sending and receiving e-mails;
    • Conversations between most living things on the planet;


     

    Synchronous Communication

    Synchronous communication is a way of exchanging data between two or more devices which use a synchronising mechanism for facilitating communication. The way of initiating communication and the order for sending messages between participants are predetermined. Simply put, devices “politely” wait for one another and communicate under strictly set rules during their conversation.

     

    Time-based Synchronisation

    Devices exchange data through a predetermined protocol, which sets the amount of time between transferring information from one device to the other. Depending on the particular case, the clocks of all participating devices may have to be synchronised at specific intervals.

     

    Speed and Data-Based Synchronisation

    In this kind of synchronous communication, before building the communications channel, the devices already know what’s the maximum amount of data which can be transmitted in one step and/or what’s the amount of data that can be expected before the other side starts expecting a reply.

     

    An example of synchronous communication, used in some models of fiscal devices

    Let’s have a fiscal device on one side (Slave) and a program located on a computer, on the other side (Host).

    • Communication is initiated only by the Host. The fiscal device (Slave) cannot initiate communication on its own. It is always initiated solely by the program on the relevant computer (Host);
    • The response to the command (message) must come within 60ms;
    • Slave’s response is based on the last received command;
    • Slave doesn’t accept additional commands until the it has replied to the last received one;
    • Host has a 500ms timeout for receiving a reply from Slave. If the timeout expires, Host has to transmit the same message again;
    • Following two unsuccessful attempts, Host should indicate there is no connection with Slave or that there is a hardware malfunction in the device;
    • The Host device sends the next command only after it has received a response from Slave or the timeout has expired;

     

    Advantages and disadvantages

    Actually, discussing pros and cons isn’t really appropriate. The technology for facilitating communication between two or more devices depends on the initial conditions, the realization opportunities and the end goal of the project.

     


    If you think anything in this article is incorrect, incomplete or insufficient, please do write to me and I will correct it.