When hosts who want to send something detect some amplitude irregularities they send a JAM signal to everyone else connected on the shared medium(HUB) to stop sending. My question is, do the both hosts send the JAM signal , and if, for example, a switch with his own hosts is connected to the HUB , will the hosts on the switch also get the JAM signal ? What will they do with the JAM signal if they receive it ?
(Assuming you're referring to CSMA/CD)
This is not correct. A host first listens to the medium (Carrier Sense) and if it is idle the host may start transmitting. During transmission it needs to monitor for a collision (Collision Detection) and if a collision is sensed it ceases data transmission and transmits a jam signal.
The jam signal is only sent by those hosts whose transmissions collided. It is propagated through repeaters and repeater hubs (within the collision domain).
So, when a host is connected to a switch which has a hub connected to it and there's a collision on the hub, the host doesn't receive a jam signal. Actually, it can simultaneously receive data orginating from another switch port.
A switch doesn't propagate jam signals but it participates in CSMA/CD like a host with its half-duplex ports. A collision (domain) ends on a switch port in any case.
All this is valid for repeaters, repeater hubs, half-duplex transmission and such, and obsolete. Gigabit Ethernet and faster speeds don't use half duplex and shared access.
Half-duplex Ethernet networks use an algorithm called Carrier Sense Multiple Access with Collision Detection (CSMA/CD). This algorithm helps devices on the same network segment to decide when to send packets and what to do in case of collisions. CSMA/CD is commonly used in networks with repeaters and hubs because these devices run in the half-duplex mode and all of their ports are in the same collision domain.
Packet collisions occur when packets are transmitted from different host at the same time. To prevent this, CSMA/CD forces a transmitting station to check for the presence of a digital signal on the wire. If no other hosts are transmitting packets, the sender begins sending the frame. The sender also monitors the wire to make sure no other hosts begin transmitting. However, if another host begins transmitting at the same time and a collision occur, the transmitting host sends a jam signal that causes all hosts on the network segment to stop sending data. After a random period of time, hosts retransmit their packets.
In the picture above we have a network of four hosts connected to a hub. Since hubs work in the half-duplex mode and each port on a hub is in the same collision domain, packet collisions can occur and CSMA/CD is used to prevent and detect them. Host A detects that there are no other signals on the network and decides to send a packet. However, Host B also assumes that no other station is transmitting and sends a packet as well. A collision occurs and it is detected by Host A and Host B. The sending stations send a jamming signal telling all hosts on the segment that a collision occurred. After a random period of time, Host A and Host B resend their packets.
But in more modern Ethernet and especially in todays networks based on Ethernet switching, the collision domain is limited to the connection from the switch to your end device and your transmission of the jam signal would not impact any other devices in the network. Switches work in full-duplex mode and each port on a switch is in a separate collision domain, so no collisions can occur.