changeset 1872:a1bfda09128a draft

add IO threads in CpuThreads
author masa
date Fri, 27 Dec 2013 20:58:30 +0900
parents c3f7ba33222d
children accb35bd3449
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/ChangeLog TaskManager/include/types.h TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/ppe/CpuThreads.h
diffstat 5 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Dec 27 03:27:15 2013 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Dec 27 20:58:30 2013 +0900
@@ -110,6 +110,10 @@
 #endif
             } else if (htask->cpu_type == ANY_ANY) { 
                 speid = cur_anySpeid++ % machineNum;
+            } else if (htask->cpu_type == IO_0) { 
+                speid = cpu_num;
+            } else if (htask->cpu_type == IO_1) { 
+                speid = cpu_num+1;
             } else {
                 // -1 してるのは
                 // htask->cpu_type - CPU_SPE で
--- a/TaskManager/ChangeLog	Fri Dec 27 03:27:15 2013 +0900
+++ b/TaskManager/ChangeLog	Fri Dec 27 20:58:30 2013 +0900
@@ -1,3 +1,10 @@
+2013-12-27 Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
+
+	read / write を専用に行うCPU threadを用意する
+	pthread_setschedparamを用いて、I/O thread のpriorityをあげる
+	set_cpu(IO_0);
+
+
 2013-12-14 Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
 
 	fileを分割してmap reduce を行うAPIを作成する。
--- a/TaskManager/include/types.h	Fri Dec 27 03:27:15 2013 +0900
+++ b/TaskManager/include/types.h	Fri Dec 27 20:58:30 2013 +0900
@@ -75,6 +75,8 @@
     SPE_3 = 9,
     SPE_4 = 10,
     SPE_5 = 11,
+    IO_0 = 126,
+    IO_1 = 127,
     GPU_ANY = 128,
     ANY_ANY = 129,
 
--- a/TaskManager/kernel/ppe/CpuThreads.cc	Fri Dec 27 03:27:15 2013 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.cc	Fri Dec 27 20:58:30 2013 +0900
@@ -17,12 +17,14 @@
 /**
  id_offset is gpu_num
 */
-CpuThreads::CpuThreads(int num, int useRefDma, int start_id) : cpu_num(num), use_refdma(useRefDma), id_offset(start_id) {
+CpuThreads::CpuThreads(int num,int i_num, int useRefDma, int start_id) :
+	cpu_num(num), use_refdma(useRefDma), id_offset(start_id) {
+    io_num = 2;
 #ifdef __CERIUM_GPU__
     gpu = new GpuThreads(useRefDma);
 #endif
-    threads = new pthread_t[cpu_num];
-    args    = new cpu_thread_arg_t[cpu_num+id_offset];
+    threads = new pthread_t[cpu_num+io_num];
+    args    = new cpu_thread_arg_t[cpu_num+io_num+id_offset];
     wait    = new Sem(0);
 
 }
@@ -31,15 +33,15 @@
 {
     memaddr mail = (memaddr)MY_SPE_COMMAND_EXIT;
     
-    for (int i = 0; i < cpu_num; i++) {
+    for (int i = 0; i < cpu_num+io_num; i++) {
         send_mail(i+id_offset, 1, &mail);
     }
 
-    for (int i = 0; i < cpu_num; i++) {
+    for (int i = 0; i < cpu_num+io_num; i++) {
         pthread_join(threads[i], NULL);
     }
 
-    for (int i = 0; i < cpu_num; i++) {
+    for (int i = 0; i < cpu_num+io_num; i++) {
         delete args[i].scheduler;
     }
 
@@ -64,6 +66,8 @@
     manager->set_scheduler(c_scheduler);
     SchedRegister(ShowTime);
     SchedRegister(StartProfile);
+    if (argt->cpuid >= cpu_num)
+	pthread_setschedparam();
 
     argt->wait->sem_v();        //準備完了したスレッドができるたびに+1していく
 
--- a/TaskManager/kernel/ppe/CpuThreads.h	Fri Dec 27 03:27:15 2013 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.h	Fri Dec 27 20:58:30 2013 +0900
@@ -12,6 +12,7 @@
     int cpuid;
     int id_offset;
     int cpu_num;
+    int priority;
     // should be syncrhonized
     MainScheduler *scheduler;
     TaskManagerImpl *manager;
@@ -44,6 +45,7 @@
     cpu_thread_arg_t *args;
     SemPtr wait; //スレッド生成時の待ち用
     int cpu_num;
+    int io_num;	// high priority thread for IO
     int use_refdma;
     int id_offset;
 #ifdef __CERIUM_GPU__