다수 대 1 통신과 다수 대 다수 통신
다수 대 1 통신 채널로 수신하기 시작합니다.
In[1]:=
![Click for copyable input](assets.ko/many-to-one-and-many-to-many-communication/In_1.png)
listener = ChannelListen["master"]
Out[1]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_1.png)
여러 세션 (예를 들어, 동일 시스템의 병렬 커널)에서 채널에 메시지를 보냅니다.
In[2]:=
![Click for copyable input](assets.ko/many-to-one-and-many-to-many-communication/In_2.png)
ParallelEvaluate[ChannelSend["master", $KernelID]]
Out[2]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_2.png)
수신된 메시지를 살펴봅니다.
In[3]:=
![Click for copyable input](assets.ko/many-to-one-and-many-to-many-communication/In_3.png)
listener["Message", All]
Out[3]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_3.png)
수신 및 송신된 메시지의 다이어그램을 봅니다.
전체 Wolfram 언어 입력 표시하기
Out[5]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_4.png)
여러 병렬 커널 세션에서 동일한 채널로 수신하기 시작합니다.
In[6]:=
![Click for copyable input](assets.ko/many-to-one-and-many-to-many-communication/In_6.png)
ParallelEvaluate[l = ChannelListen["all"]]
Out[6]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_5.png)
모든 병렬 커널이 각각의 ID를 채널로 보내도록 합니다.
In[7]:=
![Click for copyable input](assets.ko/many-to-one-and-many-to-many-communication/In_7.png)
ParallelEvaluate[ChannelSend["all", $KernelID]]
Out[7]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_6.png)
각각의 커널 ID와 함께 수신기에 의해 수신된 메시지를 봅니다.
In[8]:=
![Click for copyable input](assets.ko/many-to-one-and-many-to-many-communication/In_8.png)
ParallelEvaluate[$KernelID -> l["Message", All]]
Out[8]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_7.png)
통신 다이어그램을 알아 봅니다.
전체 Wolfram 언어 입력 표시하기
Out[9]=
![](assets.ko/many-to-one-and-many-to-many-communication/O_8.png)