1 public class Simple extends Thread {
4 public Simple(Counting mycount, int i) {
5 this.mycount = mycount;
15 // System.println("\n##threadid: " + threadid + "\n");
17 // if(threadid == ((128<<24)|(195<<16)|(180<<8)|24))
20 for(int i = 0; i < 1000; i++) {
22 // System.println("##threadid: " + threadid);
26 // if(threadid == ((128<<24)|(195<<16)|(180<<8)|21)) {
27 for(int j =0;j< 4;j++) {
29 // System.out.println("##Threadid " + j + " : " + getStatus(j));
35 FileOutputStream output = new FileOutputStream("output"+threadid);
42 String outStr = "Count = " + cc + "\n";
43 output.write(outStr.getBytes());
44 System.out.println("\n\n\nFinished!!!!!!\n\n\n\n");
50 public static void main(String[] args) {
54 int[] mid = new int[numthreads];
55 FileOutputStream out = new FileOutputStream("output");
57 /* mid[0] = (128<<24)|(195<<16)|(180<<8)|26; //dw-7
58 mid[1] = (128<<24)|(195<<16)|(180<<8)|24; //dw-5
59 mid[2] = (128<<24)|(195<<16)|(180<<8)|21; //dw-2
61 // mid[1] = (128<<24)|(195<<16)|(180<<8)|22; //dw-3
62 mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dc-1
63 mid[1] = (128<<24)|(195<<16)|(136<<8)|163; //dc-2
64 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3
65 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3
66 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3
67 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3
68 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3
69 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3
70 // mid[3] = (128<<24)|(195<<16)|(136<<8)|165; //dc-4
75 c = global new Counting();
76 s = global new Simple[numthreads];
77 for(int i = 0; i < numthreads; i++) {
78 s[i] = global new Simple(c, mid[i]);
96 System.out.println("##Done creating objects");
98 for(int i = 0; i < numthreads; i++) {
102 System.out.println("##Temp gets simple object; start temp simple object");
103 // tmp.start(mid[i]);
104 Thread.myStart(tmp,mid[i]);
107 System.out.println("\n\n##DONE starting Threads\n");
109 for(int i = 0; i < numthreads; i++) {
113 System.out.println("##Wait\n");
119 finalcount = c.count;
122 String outStr = "Count = " + finalcount + "\n";
123 out.write(outStr.getBytes());
124 System.printString("Count = "+finalcount+"\n");
152 public increment(int o) {
157 class ddd extends ccc {
162 public increment(int u)