what will be first action arp or ICMP?
ICMP is the result of initiating the ping from a source to a destination.It has got nothing to do with ARP as such.
But for any 2 devices to talk to each other, each device would need to know the
mac address or layer 2 address of the other device(assuming the devices are in same network; if not in same network,they need to reach their gateway at least). This is where ARP comes in. ARP says, can you give me the mac address for this IP address?
ARP helps in building the control plane(say building a road), before the actual ICMP traffic in this case(the data plane) starts moving.
will it go only switch1 or both switches
ARP is always restricted to a broadcast domain.Always remember that a L3 device(a router) marks the boundary of a broadcast domain.
To answer your question, ARP initiated by the PC, will have it's destination mac set to all
Remember a switch only understands mac address. When this frame(layer 2 entity), comes to SW1, it looks in it's mac-address table and since it is a broadcast, it is flooded to all ports except the one it is received on.
Next, the frame travels to SW2 and undergoes the same process to be only received by PC2.
PC2 says, hey this is my IP address and let me reply to this.This travels back all the way to PC1, but this time it is a unicast.