changeset 21:866f4329e430

title fix and add Continuation section
author riono <e165729@ie.u-ryukyu.ac.jp>
date Mon, 31 Jan 2022 17:01:47 +0900
parents d550ccb7f803
children 7fac2aee6048
files Paper/chapter/1-Christie.tex Paper/chapter/2-RewriteCS.tex Paper/master_paper.pdf Paper/master_paper.tex Paper/src/cs/AcceptThread.cs Paper/src/java/AcceptThread.java
diffstat 6 files changed, 72 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Paper/chapter/1-Christie.tex	Sat Jan 29 19:39:47 2022 +0900
+++ b/Paper/chapter/1-Christie.tex	Mon Jan 31 17:01:47 2022 +0900
@@ -69,6 +69,8 @@
 DGMに対してput操作を行うことでDGM内のqueueにDGを保管できる。
 DGを取り出す際には、CG内で宣言した変数データにannotationを付ける。
 
+\section{Christieにおける継続}
+
 
 \section{annotationを使用したデータの記述}
 
--- a/Paper/chapter/2-RewriteCS.tex	Sat Jan 29 19:39:47 2022 +0900
+++ b/Paper/chapter/2-RewriteCS.tex	Mon Jan 31 17:01:47 2022 +0900
@@ -81,6 +81,20 @@
 
 
 \section{Socket通信用のThreadをTaskに変更}
+Christieでは、Socket通信を行っている箇所もThreadを使用したmulti Threadで動作している。
+こちらも可読性や保守性のためTaskへの書き換えを行った。
+
+\lstinputlisting[label=src:JavaAcceptThread, caption=ChristieにおけるAcceptThreadの実装の一部]{src/java/AcceptThread.java}
+
+ソースコード\ref{src:JavaAcceptThread}はChristieにおけるSocket通信を行っているThreadの実行箇所である。
+無限ループを行い、他nodeがSocketで接続される度にデータ送受信専用のThreadを作成する。
+IncomingTCPConnectionではデータの受け取りを行っており、OutboundTCPConnectionではSocket通信が終了する際のコマンドの送信をそれぞれmulti Threadで行っている。
+
+\lstinputlisting[label=src:CSAcceptThread, caption=Christie SharpにおけるAcceptThreadの実装の一部]{src/cs/AcceptThread.cs}
+
+ソースコード\ref{src:CSAcceptThread}はソースコード\ref{src:JavaAcceptThread}をC\#に書き換えを行ったものである。
+Christieでは、Socket通信のためにmulti Threadを用意していた。
+
 
 
 \section{MessagePackの変更}
@@ -88,3 +102,5 @@
 
 \section{送信データの修正}
 
+
+
Binary file Paper/master_paper.pdf has changed
--- a/Paper/master_paper.tex	Sat Jan 29 19:39:47 2022 +0900
+++ b/Paper/master_paper.tex	Mon Jan 31 17:01:47 2022 +0900
@@ -12,7 +12,7 @@
 
 %\input{dummy.tex} %% font
 
-\jtitle{修士論文のテンプレート}
+\jtitle{継続を使用する並列分散フレームワークの Unity 実装}
 \etitle{} %
 \year{2022年 3月}
 \eyear{March 2022}
@@ -100,7 +100,7 @@
 %chapters
 \input{chapter/0-introduction.tex}
 \input{chapter/1-Christie.tex}
-\input{chapter/2-Unity.tex}
+\input{chapter/2-RewriteCS.tex}
 \input{chapter/conclusion.tex}
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Paper/src/cs/AcceptThread.cs	Mon Jan 31 17:01:47 2022 +0900
@@ -0,0 +1,30 @@
+public void Run() {
+  while (true) {
+    try {
+      TcpClient client = null;
+      client = listener.AcceptTcpClient();
+      client.NoDelay = true;
+
+      IPEndPoint endPoint = (IPEndPoint)client.Client.RemoteEndPoint;
+      IPAddress ipAddress = endPoint.Address;
+      IPHostEntry hostEntry = Dns.GetHostEntry(ipAddress);
+      Console.WriteLine("Accept " + hostEntry.HostName + ":" + endPoint.Port);
+
+      Connection connection = new Connection(client.Client, cgm);
+      Console.WriteLine("connection:" + connection.GetInfoString());
+      string key = "accept" + counter;
+
+      IncomingTcpConnection incoming = new IncomingTcpConnection(connection);
+      Task.Factory.StartNew(() => incoming.Run());
+
+       cgm.SetAccept(key, incoming);
+
+       OutboundTcpConnection outbound = new OutboundTcpConnection(connection);
+       Task.Factory.StartNew(() => outbound.Run());
+       counter++;
+    }
+    catch (Exception e) {
+      Console.WriteLine(e.StackTrace);
+    }
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Paper/src/java/AcceptThread.java	Mon Jan 31 17:01:47 2022 +0900
@@ -0,0 +1,22 @@
+public void run() {
+  while (true) {
+    try {
+      Socket socket = null;
+        socket = ss.accept();
+        socket.setTcpNoDelay(true);
+        System.out.println("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort());
+        Connection connection = new Connection(socket, cgm);
+        String key = "accept" + counter;
+        IncomingTcpConnection in = new IncomingTcpConnection(connection);
+        in.setName(connection.getInfoString()+"-IncomingTcp");
+        in.start();
+        cgm.setAccept(key, in);
+        OutboundTcpConnection out = new OutboundTcpConnection(connection);
+        out.setName(connection.getInfoString()+"-OutboundTcp");
+        out.start();
+        counter++;
+    } catch (IOException e) {
+        e.printStackTrace();
+    }
+  }
+}