Can someone tell me what is the relation between global transaction and transaction branch in XA?

Does transaction branch refer to one RM in global transaction or does it relates with threads?

In Xid structure, there is transaction branch id and global transaction id, normally how are they related?

Thanks & Best Regards