-2
\$\begingroup\$

I am a rookie in network engineering and what I don't understand is the master-slave communication. According to Wikipedia,'Master/slave is a model of asymmetric communication or control where one device or process (the master) controls one or more other devices or processes (the slaves) and serves as their communication hub" but that doesn't help me understand intuitively what this communication is about.

What is the difference between a master and a slave device?

Help appreciated.

\$\endgroup\$
3
  • \$\begingroup\$ Basically the same as real slavery. Master commands, and slave obeys. \$\endgroup\$
    – Parker
    Mar 19, 2021 at 19:23
  • 1
    \$\begingroup\$ Typically a master sends out requests or instructions and a slave responds to them. What exactly this means depends on the type or network. In SPI it means that the master provides the clock signal. In RS485 on a multi-drop network a protocol such as Modbus can be used to ensure that only one station transmits at a time. With HTTP the session effectively uses the client as a master, sending requests to the server and expecting responsss. A common feature is that slave devices typically don’t send out data of their own volition, although there are exceptions to this. \$\endgroup\$
    – Frog
    Mar 19, 2021 at 19:27
  • \$\begingroup\$ It is also a way to debounce data electronics.stackexchange.com/questions/426997/… \$\endgroup\$ Mar 19, 2021 at 20:12

4 Answers 4

2
\$\begingroup\$

In a master/slave communication system the master controls the communication. Slaves only "talk" in response to commands from the master.

\$\endgroup\$
2
  • \$\begingroup\$ So a slave isn't activated unless the master allows that. \$\endgroup\$
    – Miss Mulan
    Mar 19, 2021 at 19:28
  • \$\begingroup\$ It can have very different forms depending on the protocol, but It's the general idea. You can look at SPI, MIL-STD 1553. Even USB is some form of master-slave. \$\endgroup\$
    – Grabul
    Mar 19, 2021 at 19:31
1
\$\begingroup\$

In a master-slave network

  • the master is boss and is the only one allowed ask for status and send commands.
  • the slaves listen and react to commands and requests for status.

enter image description here

Figure 1. A typical master-slave RS485 network configuration. Image source: Janitza.

Take a building management system (BMS), for example.

  • The master would be the central controller.
  • The slaves would be located in the various plant rooms. These might have temperature sensors and switches as inputs and relays or analog outputs.
  • Each node has a unique address.
  • The master can send a command prefixed with a slave node address. That node will "wake up" and respond to the master, either returning information requested or acting on a command received.
  • Usually communication is with one device at a time although a broadcast facility may be implemented, for example, to switch off certain functions in the event of a fire.
  • The slaves can't communicate with each other. If passing of data is required then the master reads from one slave and passes to the other.
  • In the event of a non-communicating slave the master will give up after a timeout and move on to the next task.
\$\endgroup\$
0
\$\begingroup\$

In general, the idea of master/slave is that there is only one master (though there are multi-master protocols, where other devices can take over as "the master," so as with everything there are exceptions) and one or more slave devices (no real point if there are zero slaves.) The master initiates communications and all of the slaves listen. If a slave is addressed by the master (slaves usually have an ID or address that the master uses -- and the master usually doesn't have an address/ID), then when the master has completed its request the slave responds using some lines (one or more) that are shared by all the slave devices.

Like anything, different design requirements may modify this general idea. For example, a very common technique (used back probably before I was born) is to allow a slave device to have a reserved wire (often just one) that notifies the master that it wants communication. This might be an "interrupt line" reserved for the slave, for example. Or it can be much more complicated, such as with the APIC bus for the x86 devices. So some protocols permit "out-of-band" methods for a slave to notify the master that attention is desired. Regardless, it is the master that will initiate the actual communications required to service a slave.

Also, in mastering systems it's generally assumed that inter-slave communication doesn't occur. However, even then some protocols will support a master-mediated slave-to-slave communication. (DMA techniques can and are used in this way, from time to time.)

Just get used to the fact that given any master/slave protocol, creative people will find ways to "extend the concept." So there isn't a one-size-fits-all definition. But the general idea is that there is a controller that mediates communications and there are devices that accept that mediation and work in concert with it.

\$\endgroup\$
4
  • \$\begingroup\$ USB3 is like a relationship with equality where either end may initiate a bus control and be master then the husband(host) can be slave ;) \$\endgroup\$ Mar 19, 2021 at 20:16
  • \$\begingroup\$ @TonyStewart I haven't done anything with USB 3 (USB 2 was my last experience.) But what you write doesn't alter my writing. I mentioned that there are multi-master situations, already. In the first paragraph, in fact. That I'm not specifically aware of USB 3 qualifying, doesn't mean I'm not aware of other cases that do qualify. (I've created some myself, in fact.) In any case, I'd rather not discuss things I've no experience with, so I won't add USB 3 to my answer. It's out of my experience. \$\endgroup\$
    – jonk
    Mar 19, 2021 at 20:19
  • \$\begingroup\$ It wasn’t a contradiction, rather support for your multi-host scenario. Keep up the good answers. I’m refinishing my Hardwood floors (drum, disk: vacuum , paint, sand repeat.) \$\endgroup\$ Mar 19, 2021 at 20:22
  • 1
    \$\begingroup\$ @TonyStewart Ah. Got it. And then thanks for the addition! \$\endgroup\$
    – jonk
    Mar 19, 2021 at 20:26
0
\$\begingroup\$

...that doesnt help me understand intuitively what this communication is about.

Master-slave only refers to HOW the flow of communication in a network is controlled. You have a number of other answers that go into this in some detail but briefly one node in a network, the master, controls how the other nodes, the slaves, communicate.

But master-slave doesn't define WHAT information is being communicated. It's whatever information the application needs to communicate. So a PC (the master) with a USB drive (the slave) plugged into it will transfer files to and from the USB drive. In Transistor's Building Management System example the BMS (the master) controlling the temperature of a building may have an RS-485 network reading temperature values from remote temperature sensors (slaves) and sending out on/off commands to the boiler/furnace and heating zone control valves (also slaves). So what is being communicated is entirely application-dependent.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.