annotate tableau3.cbc @ 10:35d0358b3fe6

update Modern CbC Compiler
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 01 Jul 2019 22:18:03 +0900
parents a15437a1e94c
children 190dadd8405b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /*
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 ** Dining Philosophers Problem's scheduler
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 ** with state developper as a tableau method
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
5 ** 連絡先: 琉球大学情報工学科 河野 真治
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp)
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 **
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 ** このソースのいかなる複写,改変,修正も許諾します。ただし、
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ** その際には、誰が貢献したを示すこの部分を残すこと。
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 ** 再配布や雑誌の付録などの問い合わせも必要ありません。
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 ** 営利利用も上記に反しない範囲で許可します。
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ** バイナリの配布の際にはversion messageを保存することを条件とします。
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 ** このプログラムについては特に何の保証もしない、悪しからず。
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 **
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
15 ** Everyone is permitted to do anything on this program
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ** including copying, modifying, improving,
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 ** as long as you don't try to pretend that you wrote it.
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
18 ** i.e., the above copyright notice has to appear in all copies.
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 ** Binary distribution requires original version messages.
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 ** You don't have to ask before copying, redistribution or publishing.
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 */
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include <stdlib.h>
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include <time.h>
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
26 #include "dpp3.h"
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 #include "queue.h"
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "memory.h"
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 #include "state_db.h"
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 #include "ltl.h"
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 int NUM_PHILOSOPHER = 5; /* A number of philosophers must be more than 2. */
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 static void *env;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 static PhilsPtr phils_list = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 static int max_step = 100;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 static StateDB state_db;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 static MemoryPtr mem;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 static StateNode st;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 static int always_flag; // for LTL
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
45
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
46 //FIXME
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
47 __code do_action(PhilsPtr phils, TaskPtr list)
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
48 {
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
49 switch (phils->next) {
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
50 case PutDownLeftFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
51 goto putdown_lfork(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
52 case PutDownRightFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
53 goto putdown_rfork(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
54 case PickUpLeftFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
55 goto pickup_lfork(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
56 case PickUpRightFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
57 goto pickup_rfork(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
58 case Thinking:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
59 goto thinking(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
60 case Eating:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
61 goto eating(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
62 case WaitRightFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
63 goto hungry2(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
64 case WaitLeftFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
65 goto hungry1(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
66 case PutDownFork:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
67 goto putdown_fork(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
68 default:
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
69 printf("invalid action¥n");
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
70 exit(1);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
71 }
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
72 __code (*action) (PhilsPtr, TaskPtr) = thinking;
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
73 goto action(phils, list);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
74 }
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 int
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 list_length(TaskPtr list)
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 int length;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 TaskPtr t;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 if (!list) return 0;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 t = list->next;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 for (length = 1; t && t != list; length++) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 t = t->next;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 return length;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 TaskPtr
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 get_task(int num, TaskPtr list)
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 while (num-- > 0) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 list = list->next;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 return list;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 static TaskIteratorPtr task_iter;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 static int depth,count;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 /*
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 Performe depth frist search
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 Possible task iterleave is generated by TaskIterator
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 (using task ring)
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 State are recorded in StateDB
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 all memory fragments are regsitered by add_memory_range()
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 including task queue
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 */
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
113 __code tableau(TaskPtr list)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 StateDB out;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 st.hash = get_memory_hash(mem,0);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 if (lookup_StateDB(&st, &state_db, &out)) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 // found in the state database
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 //printf("found %d\n",count);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 while(!(list = next_task_iterator(task_iter))) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 // no more branch, go back to the previous one
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 TaskIteratorPtr prev_iter = task_iter->prev;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 if (!prev_iter) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 printf("All done count %d\n",count);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 printf("Number of unique states %d\n", state_count());
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 memory_usage();
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 show_result(always_flag);
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
129 exit(0);
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 //printf("no more branch %d\n",count);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 depth--;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 free_task_iterator(task_iter);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 task_iter = prev_iter;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 // return to previous state
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 // here we assume task list is fixed, we don't have to
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 // recover task list itself
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 restore_memory(task_iter->state->memory);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 //printf("restore list %x next %x\n",(int)list,(int)(list->next));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 } else {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 // one step further
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 depth++;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 task_iter = create_task_iterator(list,out,task_iter);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 //printf("depth %d count %d\n", depth, count++);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 count++;
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
148
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
149 goto do_action(list->phils, list);
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152 __code get_next_task_fifo(TaskPtr list)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 TaskPtr t = list;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 TaskPtr e;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
156
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 if (max_step--<0) goto die("Simuration end.");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 list = list->next;
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
160 goto do_action(list->phils, list);
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
163 __code scheduler(PhilsPtr phils, TaskPtr list)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 goto check(&always_flag, phils, list);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 // goto next_next_task_fifo(list);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
169 __code task_entry1(int count, PhilsPtr self, TaskPtr list, TaskPtr last);
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
171 __code task_entry2(int count,PhilsPtr self, TaskPtr list,TaskPtr last, TaskPtr q)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 if (!q) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 goto die("Can't allocate Task\n");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 } else {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 add_memory_range(q,sizeof(Task),&mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 goto enqueue(count, self, list, last, q, task_entry1);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
181 __code task_entry1(int count, PhilsPtr self, TaskPtr list, TaskPtr last)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 StateDB out;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 /*
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 printf("int count %d, PhilsPtr self %x, TaskPtr list %x, TaskPtr last %x\n",
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 count, self, list, last);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 */
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 if (count++ < NUM_PHILOSOPHER) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 self = self->left;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 goto create_queue(count,self,list,last,task_entry2);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 } else {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 // make circular task list
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 last->next = list;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 st.memory = mem;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 st.hash = get_memory_hash(mem,0);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 lookup_StateDB(&st, &state_db, &out);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 task_iter = create_task_iterator(list,out,0);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 // start first task
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
200 goto do_action(list->phils, list);
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
204 __code task_entry0(int count, PhilsPtr self, TaskPtr list, TaskPtr last, TaskPtr q)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 add_memory_range(q,sizeof(Task),&mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 goto task_entry1(count, self, q, q);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
210 __code init_final(PhilsPtr self)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 self->right = phils_list;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 phils_list->left = self;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 self->right_fork = phils_list->left_fork;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 always_flag = 1;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 //add_memory_range(&always_flag, sizeof(int), &mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 //printf("init all\n");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 goto create_queue(1, self, 0, 0, task_entry0);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
222 __code init_phils2(PhilsPtr self, int count, int id)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 PhilsPtr tmp_self;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 tmp_self = (PhilsPtr)malloc(sizeof(Phils));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 if (!tmp_self) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 goto die("Can't allocate Phils\n");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 self->right = tmp_self;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 tmp_self->id = id;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 tmp_self->right_fork = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 tmp_self->left_fork = self->right_fork;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 tmp_self->right = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 tmp_self->left = self;
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
236 tmp_self->next = PickUpLeftFork;
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 add_memory_range(tmp_self,sizeof(Phils),&mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 count--;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 id++;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 if (count == 0) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 goto init_final(tmp_self);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 } else {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 goto init_fork2(tmp_self, count, id);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
249 __code init_fork2(PhilsPtr self, int count, int id)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 ForkPtr tmp_fork;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 tmp_fork = (ForkPtr)malloc(sizeof(Fork));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 if (!tmp_fork) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 goto die("Can't allocate Fork\n");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 tmp_fork->id = id;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 tmp_fork->owner = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 self->right_fork = tmp_fork;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 add_memory_range(tmp_fork,sizeof(Fork),&mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
261
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 goto init_phils2(self, count, id);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
264
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
265 __code init_phils1(ForkPtr fork, int count, int id)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 PhilsPtr self;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
268
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 self = (PhilsPtr)malloc(sizeof(Phils));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 if (!self) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 goto die("Can't allocate Phils\n");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 phils_list = self;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 self->id = id;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 self->right_fork = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 self->left_fork = fork;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 self->right = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 self->left = NULL;
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
279 self->next = PickUpLeftFork;
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 add_memory_range(self,sizeof(Phils),&mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
281
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 count--;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 id++;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 goto init_fork2(self, count, id);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
288 __code init_fork1(int count)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 ForkPtr fork;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 int id = 1;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
292
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 fork = (ForkPtr)malloc(sizeof(Fork));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 if (!fork) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 goto die("Can't allocate Fork\n");
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 fork->id = id;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 fork->owner = NULL;
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 add_memory_range(fork,sizeof(Fork),&mem);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
300
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 goto init_phils1(fork, count, id);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
303
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
304 __code die(char *err)
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 printf("%s\n", err);
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
307 exit(1);
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
309
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 int main(int ac, char *av[])
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 {
10
35d0358b3fe6 update Modern CbC Compiler
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
312 env = _CbC_environment;
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 // srand((unsigned)time(NULL));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 // srandom((unsigned long)time(NULL));
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 reset_state_count();
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 srandom(555);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
317
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 if (ac==2) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 NUM_PHILOSOPHER = atoi(av[1]);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 if (NUM_PHILOSOPHER >10 ||NUM_PHILOSOPHER < 2) {
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 printf("illegal number of philosopher = %d\n", NUM_PHILOSOPHER );
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
322 return 1;
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 //printf("number of philosopher = %d\n", NUM_PHILOSOPHER );
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
326
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 goto init_fork1(NUM_PHILOSOPHER);
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 }
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
329
8
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
330 /* waiting for right fork */
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
331 __code hungry2(PhilsPtr self, TaskPtr current_task)
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
332 {
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
333 printf("%d: hungry2\n", self->id);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
334 self->next = PickUpRightFork;
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
335 goto scheduler(self, current_task);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
336 }
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
337
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
338 /* waiting for left fork */
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
339 __code hungry1(PhilsPtr self, TaskPtr current_task)
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
340 {
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
341 printf("%d: hungry1\n", self->id);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
342 self->next = PickUpLeftFork;
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
343 goto scheduler(self, current_task);
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
344 }
a15437a1e94c Fix tableau3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
345
0
d4bc23cb728b Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 /* end */