#define HOME_DIR "home/adash"
#define STR_SIZE 256
#define CREAT_FILE "creates.txt"
-#define FACTOR (0.05)
+#define FACTOR (0.10)
unsigned int num_lines;
for (i = 0; i < numCmd; i++) {
int idx = rand() % numCrCmd;
int test = rand() % 100;
- if(test < 10 ) {
+ if(test < (FACTOR * 100)) {
rd_data[idx][0] = 'c';
fprintf(fp, "%s", rd_data[idx]);
} else {
--- /dev/null
+public class DFile {
+ char [] data;
+ int size;
+ public DFile() {
+ data= new char[4096];
+ size=data.length;
+ }
+ public void write(int offset, char[] towrite) {
+ int length=offset+towrite.length;
+ if (length>size) {
+ if (length>data.length) {
+ char [] ptr= new char[length];
+ for(int i=0;i<size;i++) {
+ ptr[i]=data[i];
+ }
+ this.data=ptr;
+ }
+ size=length;
+ }
+ int j=0;
+ for(int i=offset;i<length;i++)
+ data[i]=towrite[j++];
+ }
+ public char[] read() {
+ char[] ptr=new char[size];
+ for(int i=0;i<size;i++)
+ ptr[i]=data[i];
+ return ptr;
+ }
+}
--- /dev/null
+public class Directory {
+ GlobalString name;
+ DistributedHashMap table;
+ DistributedLinkedList files;
+
+ public Directory(GlobalString name) {
+ this.name=name;
+ this.table= new DistributedHashMap(500, 0.75f);
+ this.files= new DistributedLinkedList();
+ }
+
+ public DFile getFile(GlobalString name) {
+ return (DFile) table.get(name);
+ }
+
+ public DFile createFile(GlobalString name) {
+ DFile file= new DFile();
+ if (!table.containsKey(name)) {
+ files.add(name);
+ }
+ table.put(name, file);
+ return file;
+ }
+
+ public Directory getDirectory(GlobalString name) {
+ return (Directory) table.get(name);
+ }
+
+ public Directory makeDirectory(GlobalString name) {
+ if (!table.containsKey(name)) {
+ Directory d= new Directory(name);
+ files.add(name);
+ table.put(name, d);
+ return d;
+ } else
+ return (Directory) table.get(name);
+ }
+
+ public void init() {
+ Random r=new Random();
+ for(int count=0; count<100; count++) {
+ GlobalString filename= new GlobalString(String.valueOf(r.nextInt(200)));
+ createFile(filename);
+ }
+ }
+}
--- /dev/null
+public class DistributedHashMap {
+ DistributedHashEntry[] table;
+ float loadFactor;
+
+ public DistributedHashMap(int initialCapacity, float loadFactor) {
+ init(initialCapacity, loadFactor);
+ }
+
+ private void init(int initialCapacity, float loadFactor) {
+ table= new DistributedHashEntry[initialCapacity];
+ this.loadFactor=loadFactor;
+ }
+
+ private static int hash1(int hashcode, int length) {
+ int value=hashcode%length;
+ if (value<0)
+ return -value;
+ else
+ return value;
+ }
+
+ Object remove(Object key) {
+ int hashcode=key.hashCode();
+ int index1=hash1(hashcode, table.length);
+ DistributedHashEntry dhe=table[index1];
+ if (dhe==null)
+ return null;
+ DHashEntry ptr=dhe.array;
+
+ if (ptr!=null) {
+ if (ptr.hashval==hashcode&&ptr.key.equals(key)) {
+ dhe.array=ptr.next;
+ //dhe.count--;
+ return ptr.value;
+ }
+ while(ptr.next!=null) {
+ if (ptr.hashval==hashcode&&ptr.next.key.equals(key)) {
+ Object oldvalue=ptr.value;
+ ptr.next=ptr.next.next;
+ //dhe.count--;
+ return oldvalue;
+ }
+ ptr=ptr.next;
+ }
+ }
+ return null;
+ }
+
+ Object get(Object key) {
+ int hashcode=key.hashCode();
+ int index1=hash1(hashcode, table.length);
+
+ DistributedHashEntry dhe=table[index1];
+ if (dhe==null)
+ return null;
+
+ DHashEntry ptr=dhe.array;
+
+ while(ptr!=null) {
+ if (ptr.hashval==hashcode
+ &&ptr.key.equals(key)) {
+ return ptr.value;
+ }
+ ptr=ptr.next;
+ }
+ return null;
+ }
+
+ boolean containsKey(Object key) {
+ int hashcode=key.hashCode();
+ int index1=hash1(hashcode, table.length);
+ DistributedHashEntry dhe=table[index1];
+ if (dhe==null)
+ return false;
+
+ DHashEntry ptr=dhe.array;
+
+ while(ptr!=null) {
+ if (ptr.hashval==hashcode
+ &&ptr.key.equals(key)) {
+ return true;
+ }
+ ptr=ptr.next;
+ }
+ return false;
+ }
+
+ Object put(Object key, Object value) {
+ int hashcode=key.hashCode();
+ int index1=hash1(hashcode, table.length);
+ DistributedHashEntry dhe=table[index1];
+ if (dhe==null) {
+ dhe= new DistributedHashEntry();
+ table[index1]=dhe;
+ }
+ DHashEntry ptr=dhe.array;
+
+ while(ptr!=null) {
+ if (ptr.hashval==hashcode&&ptr.key.equals(key)) {
+ Object oldvalue=ptr.value;
+ ptr.value=value;
+ return oldvalue;
+ }
+ ptr=ptr.next;
+ }
+
+ DHashEntry he= new DHashEntry();
+ he.value=value;
+ he.key=key;
+ he.hashval=hashcode;
+ he.next=dhe.array;
+ dhe.array=he;
+
+ //dhe.count++;
+ //System.out.println("dhe.count= " + dhe.count);
+ return null;
+ }
+}
+
+
+class DistributedHashEntry {
+ public DistributedHashEntry() {
+ }
+ int count;
+ DHashEntry array;
+}
+
+
+class DHashEntry {
+ public DHashEntry() {
+ }
+ int hashval;
+ Object key;
+ Object value;
+ DHashEntry next;
+}
--- /dev/null
+public class DistributedLinkedListElement {
+ public DistributedLinkedListElement next;
+ public DistributedLinkedListElement prev;
+ public Object element;
+
+ public DistributedLinkedListElement(Object e,
+ DistributedLinkedListElement n,
+ DistributedLinkedListElement p) {
+ element = e;
+ next = n;
+ prev = p;
+ }
+}
+
+public class DistributedLinkedList {
+ DistributedLinkedListElement head;
+ DistributedLinkedListElement tail;
+ int size;
+
+ public DistributedLinkedList() {
+ clear();
+ }
+
+ public add(Object o) {
+ if( tail == null ) {
+ head = new DistributedLinkedListElement(o, null, null);
+ tail = head;
+
+ } else {
+ tail.next = new DistributedLinkedListElement(o, null, tail);
+ tail = tail.next;
+ }
+ size++;
+ }
+
+ public addFirst(Object o) {
+ if( head == null ) {
+ head = new DistributedLinkedListElement(o, null, null);
+ tail = head;
+
+ } else {
+ head.prev = new DistributedLinkedListElement(o, head, null);
+ head = head.prev;
+ }
+ size++;
+ }
+
+ public addLast(Object o) {
+ add(o);
+ }
+
+ public clear() {
+ head = null;
+ tail = null;
+ size = 0;
+ }
+
+ public int size() {
+ return size;
+ }
+
+ public boolean isEmpty() {
+ return size == 0;
+ }
+
+ public Object clone() {
+ System.out.println("LinkedList.clone() not implemented.");
+ System.exit(-1);
+ }
+
+ public boolean contains(Object o) {
+ DistributedLinkedListElement e = head;
+ if (o==null) {
+ while(e!=null) {
+ if (e.element==null) {
+ return true;
+ }
+ e=e.next;
+ }
+ return false;
+ } else {
+ while( e != null ) {
+ if (o.equals(e.element)) {
+ return true;
+ }
+ e = e.next;
+ }
+ }
+ return false;
+ }
+
+ public Object getFirst() {
+ if( head == null ) {
+ return null;
+ }
+ return head.element;
+ }
+
+ public Object getLast() {
+ if( tail == null ) {
+ return null;
+ }
+ return tail.element;
+ }
+
+ public Object element() {
+ getFirst();
+ }
+
+ public Object peek() {
+ getFirst();
+ }
+
+ public Object peekFirst() {
+ getFirst();
+ }
+
+ public Object peekLast() {
+ getLast();
+ }
+
+ public Object removeFirst() {
+ if( head == null ) {
+ System.out.println("LinkedList: illegal removeFirst()");
+ System.exit(-1);
+ }
+ Object o = head.element;
+ head = head.next;
+ if( head != null ) {
+ head.prev = null;
+ } else {
+ tail = null;
+ }
+ size--;
+ return o;
+ }
+
+ public Object removeLast() {
+ if( tail == null ) {
+ System.out.println("LinkedList: illegal removeLast()");
+ System.exit(-1);
+ }
+ Object o = tail.element;
+ tail = tail.prev;
+ if( tail != null ) {
+ tail.next = null;
+ } else {
+ head = null;
+ }
+ size--;
+ return o;
+ }
+
+ public void remove(Object o) {
+ if( head == null ) {
+ System.out.println("LinkedList: illegal remove( Object o )");
+ System.exit(-1);
+ }
+ DistributedLinkedListElement e = head;
+ while( e != null ) {
+ if( e.element == o ) {
+ if( e.prev != null ) {
+ e.prev.next = e.next;
+ }
+ if( e.next != null ) {
+ e.next.prev = e.prev;
+ }
+ size--;
+ return;
+ }
+ e = e.next;
+ }
+ System.out.println("LinkedList: illegal remove( Object o ), "+o+" not found");
+ System.exit(-1);
+ }
+
+ public Object pop() {
+ Object o = getFirst();
+ removeFirst();
+ return o;
+ }
+
+ public void push(Object o) {
+ addFirst(o);
+ }
+
+ public Iterator iterator() {
+ return new DistributedLinkedListIterator(this);
+ }
+}
+
+public class DistributedLinkedListIterator extends Iterator {
+ DistributedLinkedList ll;
+ DistributedLinkedListElement itr;
+ Object removeable;
+
+ public DistributedLinkedListIterator(DistributedLinkedList ll) {
+ this.ll = ll;
+ itr = ll.head;
+ removeable = null;
+ }
+
+ public boolean hasNext() {
+ return (null != itr);
+ }
+
+ public Object next() {
+ if( itr == null ) {
+ System.out.println("LinkedListIterator: illegal next()");
+ System.exit(-1);
+ }
+ removeable = itr.element;
+ itr = itr.next;
+ return removeable;
+ }
+
+ public void remove() {
+ if( removeable == null ) {
+ System.out.println("LinkedListIterator: illegal remove()");
+ System.exit(-1);
+ }
+ ll.remove(removeable);
+ removeable = null;
+ }
+}
+
/*\r
+ System.out.println(key);\r
Usage :\r
./FileSystem.bin <num thread> <datafile prefix>\r
*/\r
\r
-\r
-\r
-public class FileSystem {\r
- HashMap dir; // Directory \r
- HashMap fs; // File system\r
- LinkedList dir_list;\r
- String inputfile;\r
- int mid;\r
- \r
- public FileSystem(HashMap dir, HashMap fs, LinkedList dir_list, String filename) {\r
- this.dir = dir;\r
- this.fs = fs;\r
- this.dir_list = dir_list;\r
- this.inputfile = new String("../data/"+filename + "0");\r
- }\r
- \r
- public void init() {\r
- fillHashTable();\r
- }\r
- \r
- public void fillHashTable() {\r
- String path;\r
- LinkedList list; \r
-\r
- path = new String("/home/"); // root is 'home'\r
- list = new LinkedList();\r
-\r
- dir.put(path, list);\r
- dir_list.add(path);\r
- }\r
- \r
- public static void fillTodoList(String file, LinkedList todoList) {\r
- FileInputStream fis;\r
- String comm;\r
- char c;\r
- String key;\r
- String val;\r
- Transaction t;\r
-\r
- fis = new FileInputStream(file);\r
-\r
- while ((comm = fis.readLine()) != null) { // 'command' 'path'\r
- c = comm.charAt(0); // ex) w /home/abc.c \r
- key = comm.subString(2);\r
- t = new Transaction(c, key);\r
- todoList.add(t);\r
- }\r
- }\r
-\r
- public void execute() {\r
- Transaction t;\r
-\r
- char command;\r
- String key;\r
- String val;\r
- boolean isDir;\r
-\r
- int index;\r
-\r
- LinkedList todoList = new LinkedList();\r
- fillTodoList(inputfile, todoList);\r
-\r
- long st = System.currentTimeMillis();\r
- long fi;\r
- while (!todoList.isEmpty()) {\r
- t = (Transaction)(todoList.removeFirst());\r
-\r
- command = t.getCommand();\r
- key = t.getKey();\r
-\r
- index = key.lastindexOf('/');\r
- if (index+1 == key.length()) \r
- isDir = true;\r
- else \r
- isDir = false;\r
- \r
- if (command == 'r') {\r
- //System.out.println("["+command+"] ["+key+"]");\r
- if (isDir == true) {\r
- readDirectory(key);\r
- }\r
- else {\r
- readFile(key);\r
- }\r
+public class FileSystem extends Thread {\r
+ Directory root;\r
+ Directory current;\r
+ int mid;\r
+\r
+ public FileSystem(Directory root, int mid) {\r
+ this.root=root;\r
+ this.mid = mid;\r
+ }\r
+\r
+ public void getRoot() {\r
+ current=root;\r
+ }\r
+\r
+ public DFile getFile(GlobalString name) {\r
+ return current.getFile(name);\r
+ }\r
+\r
+ public DFile createFile(GlobalString name) {\r
+ return current.createFile(name);\r
+ }\r
+\r
+ public void run() {\r
+ long st = System.currentTimeMillis();\r
+ long fi;\r
+ {\r
+ current=root.makeDirectory( new GlobalString(String.valueOf(mid)));\r
+ }\r
+ Random r=new Random();\r
+ char ptr[]=new char[1024];\r
+ for(int i=0;i<40000;i++) {\r
+ {\r
+ for(int count=0;count<10;count++) {\r
+ int value=r.nextInt(100);\r
+ GlobalString filename= new GlobalString(String.valueOf(r.nextInt(200)));\r
+ if (value<10) {//10% writes\r
+ //System.out.println("Write: ");\r
+ //Do write\r
+ DFile f=getFile(filename);\r
+ if (f==null) {\r
+ f=createFile(filename);\r
+ }\r
+ f.write(10,ptr);\r
+ } else {\r
+ //System.out.println("Read: ");\r
+ //Do read\r
+ DFile f=getFile(filename);\r
+ if(f!=null)\r
+ f.read();\r
+ }\r
+ }\r
}\r
- else if (command == 'c') {\r
- //System.out.println("["+command+"] ["+key+"]");\r
- if (isDir == true) {\r
- createDirectory(key);\r
- }\r
- else {\r
- val = t.getValue();\r
- val = new String(val);\r
- createFile(key, val);\r
- }\r
- }\r
}\r
fi = System.currentTimeMillis();\r
System.out.println("\n\n\n I'm done - Time Elapse : "+ ((double)(fi-st)/1000) + "\n\n\n");\r
+ }\r
\r
- //output();\r
-\r
-// RecoveryStat.printRecoveryStat();\r
- }\r
-\r
- public void output() { \r
- Iterator iter;\r
- String str;\r
-\r
- iter = dir_list.iterator();\r
-\r
- while (iter.hasNext()) {\r
- str = (String)(iter.next());\r
- //System.printString(str + "\n");\r
- }\r
- }\r
-\r
- public void readFile(String key) {\r
- String val;\r
+ public static void main(String[] args) {\r
+ int NUM_THREADS = 3;\r
\r
- val = (String)(fs.get(key));\r
- if (val != null) {\r
-// System.out.println("<"+val+">");\r
- }\r
- else {\r
- System.out.println("No such file or directory");\r
- }\r
- }\r
-\r
- public void readDirectory(String key) {\r
- LinkedList list;\r
- Iterator iter;\r
- String val;\r
-\r
- list = (LinkedList)(dir.get(key));\r
-\r
- if (list != null) {\r
- iter = list.iterator();\r
- while (iter.hasNext() == true) {\r
- val = (String)(iter.next());\r
-// System.out.print("["+val+"] ");\r
- }\r
-// System.out.println("");\r
- }\r
- else {\r
- System.out.println("No such file or directory");\r
- }\r
- }\r
-\r
- public void createFile(String key, String val) {\r
- String path;\r
- String target;\r
- int index;\r
- LinkedList list;\r
-\r
- index = key.lastindexOf('/');\r
- path = key.subString(0, index+1);\r
- target = key.subString(index+1);\r
-\r
- if (dir.containsKey(path)) {\r
- list = (LinkedList)(dir.get(path));\r
- list.push(target);\r
- dir.put(path, list);\r
- fs.put(key, val);\r
- }\r
- else {\r
- System.out.println("Cannot create file");\r
- }\r
- }\r
-\r
- public void createDirectory(String key) {\r
- int index;\r
- String path;\r
- String target;\r
- LinkedList list;\r
-\r
- index = key.lastindexOf('/', key.length()-2);\r
-\r
- if (index != -1) {\r
- path = key.subString(0, index+1);\r
- target = key.subString(index+1);\r
-\r
- if (dir.containsKey(path)) {\r
- list = (LinkedList)(dir.get(path));\r
- list.push(target);\r
- dir.put(path, list);\r
-\r
- list = new LinkedList();\r
- dir.put(key, list);\r
- dir_list.add(key);\r
- }\r
- else {\r
- System.out.println("Cannot create directory");\r
- }\r
- }\r
- }\r
- \r
- public static void main(String[] args) {\r
- String filename;\r
- int NUM_THREADS = 1;\r
-\r
- if (args.length == 2) {\r
- NUM_THREADS = Integer.parseInt(args[0]);\r
- filename = args[1];\r
- }\r
- else {\r
- System.out.println("usage: ./FileSystem.bin <numthreads> <data>");\r
- System.exit(0);\r
- }\r
- \r
- FileSystem file;\r
+ if (args.length == 1) {\r
+ NUM_THREADS = Integer.parseInt(args[0]);\r
+ }\r
+ else {\r
+ System.out.println("./FileSystem.bin master <num_thread>");\r
+ System.exit(0);\r
+ }\r
\r
- HashMap fs = new HashMap(500, 0.75f); // file system\r
- HashMap dir = new HashMap(500, 0.75f); // directory\r
- LinkedList dir_list = new LinkedList();\r
- \r
- file = new FileSystem(dir, fs, dir_list, filename);\r
- file.init();\r
+ FileSystem[] lus;\r
+ {\r
+ Directory root= new Directory(null);\r
+ lus = new FileSystem[NUM_THREADS];\r
+ for(int i = 0; i < NUM_THREADS; i++) {\r
+ lus[i] = new FileSystem(root, i);\r
+ }\r
+ }\r
\r
- file.execute();\r
- \r
- System.printString("Finished\n");\r
- }\r
-}\r
+ FileSystem tmp;\r
+ /* Start threads */\r
+ for(int i = 0; i < NUM_THREADS; i++) {\r
+ {\r
+ tmp = lus[i];\r
+ }\r
+ tmp.run();\r
+ }\r
\r
-public class Transaction { // object for todoList\r
- char command; // r: read, w: write\r
- String key;\r
- String val;\r
- \r
- Transaction (char c, String key) {\r
- command = c;\r
- \r
- this.key = new String(key);\r
- this.val = new String();\r
- }\r
- \r
- Transaction (char c, String key, String val) {\r
- command = c;\r
- \r
- this.key = new String(key);\r
- this.val = new String(val);\r
- }\r
- \r
- public char getCommand() {\r
- return command;\r
- }\r
- \r
- public String getKey() {\r
- return key;\r
- }\r
- \r
- public String getValue() {\r
- return val;\r
- }\r
+ System.printString("Finished\n");\r
+ }\r
}\r
--- /dev/null
+public class GlobalString {
+ char value[];
+ int count;
+ int offset;
+ private int cachedHashcode;
+
+ public GlobalString() {
+ }
+
+ public GlobalString(String str) {
+ {
+ value = new char[str.count];
+ for(int i =0; i< str.count;i++) {
+ value[i] = str.value[i+str.offset];
+ }
+ count = str.count;
+ offset = 0;
+ }
+ }
+
+ public GlobalString(GlobalString gstr) {
+ {
+ this.value = gstr.value;
+ this.count = gstr.count;
+ this.offset = gstr.offset;
+ }
+ }
+
+ public GlobalString(GlobalStringBuffer gsb) {
+ {
+ value = new char[gsb.length()];
+ count = gsb.length();
+ offset = 0;
+ for (int i = 0; i < count; i++)
+ value[i] = gsb.value[i];
+ }
+ }
+
+ public int hashCode() {
+ if (cachedHashcode!=0)
+ return cachedHashcode;
+ int hashcode=0;
+ for(int i=0; i<count; i++)
+ hashcode=hashcode*31+value[i+offset];
+ cachedHashcode=hashcode;
+ return hashcode;
+ }
+
+
+ public static char[] toLocalCharArray(GlobalString str) {
+ char[] c;
+ int length;
+
+ {
+ length = str.length();
+ }
+
+ c = new char[length];
+
+ {
+ for (int i = 0; i < length; i++) {
+ c[i] = str.value[i+str.offset];
+ }
+ }
+ return c;
+ }
+
+ public String toLocalString() {
+ return new String(toLocalCharArray(this));
+ }
+
+ public int length() {
+ return count;
+ }
+
+ public int indexOf(int ch, int fromIndex) {
+ for (int i = fromIndex; i < count; i++)
+ if (this.charAt(i) == ch)
+ return i;
+ return -1;
+ }
+
+ public int lastindexOf(int ch) {
+ return this.lastindexOf(ch, count - 1);
+ }
+
+ public int lastindexOf(int ch, int fromIndex) {
+ for (int i = fromIndex; i > 0; i--)
+ if (this.charAt(i) == ch)
+ return i;
+ return -1;
+ }
+
+ public char charAt(int i) {
+ return value[i+offset];
+ }
+
+ public int indexOf(GlobalString str) {
+ return this.indexOf(str, 0);
+ }
+
+ public int indexOf(GlobalString str, int fromIndex) {
+ if (fromIndex < 0)
+ fromIndex = 0;
+ for (int i = fromIndex; i <= (count-str.count); i++)
+ if (regionMatches(i, str, 0, str.count))
+ return i;
+ return -1;
+ }
+
+ public boolean regionMatches(int toffset, GlobalString other, int ooffset, int len) {
+ if (toffset < 0 || ooffset < 0 || (toffset+len) > count || (ooffset+len) > other.count)
+ return false;
+
+ for (int i = 0; i < len; i++) {
+ if (other.value[i+other.offset+ooffset] != this.value[i+this.offset+toffset])
+ return false;
+ }
+ return true;
+ }
+
+ public GlobalString substring(int beginIndex) {
+ return substring(beginIndex, this.count);
+ }
+
+ public GlobalString subString(int beginIndex) {
+ return subString(beginIndex, this.count);
+ }
+
+ public GlobalString subString(int beginIndex, int endIndex) {
+ return substring(beginIndex, endIndex);
+ }
+
+ public GlobalString substring(int beginIndex, int endIndex) {
+ GlobalString str;
+ {
+ str = new GlobalString();
+ }
+ if (beginIndex > this.count || endIndex > this.count || beginIndex > endIndex) {
+ System.printString("Index error\n");
+ }
+ {
+ str.value = this.value;
+ str.count = endIndex-beginIndex;
+ str.offset = this.offset + beginIndex;
+ }
+ return str;
+ }
+
+ public boolean equals(String str) {
+ GlobalString gstr;
+
+ {
+ gstr = new GlobalString(str);
+ }
+ return equals(gstr);
+ }
+
+ public boolean equals(Object o) {
+ if (o.getType()!= getType())
+ return false;
+
+ GlobalString gs = (GlobalString)o;
+ if (gs.count!= count)
+ return false;
+
+ for(int i = 0; i < count; i++) {
+ if (gs.value[i+gs.offset] != value[i+offset])
+ return false;
+ }
+ return true;
+ }
+}
--- /dev/null
+public class GlobalStringBuffer {
+ char value[];
+ int count;
+ // private static final int DEFAULTSIZE=16;
+
+ public GlobalStringBuffer(String str) {
+ GlobalString gstr;
+
+ {
+ gstr = new GlobalString(str);
+ }
+ GlobalStringBuffer(gstr);
+ }
+
+ public GlobalStringBuffer(GlobalString str) {
+ {
+ value = new char[str.count+16];
+ count = str.count;
+ for (int i = 0; i < count; i++)
+ value[i] = str.value[i+str.offset];
+ }
+ }
+
+ public GlobalStringBuffer(StringBuffer sb) {
+ {
+ value = new char[sb.count];
+ for (int i = 0; i < sb.count; i++)
+ value[i] = sb.value[i];
+ count = sb.count;
+ }
+ }
+
+ public GlobalStringBuffer() {
+ {
+ value = new char[16]; //16 is DEFAULTSIZE
+ count = 0;
+ }
+ }
+
+ public int length() {
+ return count;
+ }
+
+ public int capacity() {
+ return value.length;
+ }
+
+ public char charAt(int x) {
+ return value[x];
+ }
+
+ public GlobalStringBuffer append(char c) {
+ return append(String.valueOf(c));
+ }
+
+ public GlobalStringBuffer append(String s) {
+ GlobalString str;
+ {
+ str = new GlobalString(s);
+ }
+ return append(str);
+ }
+
+ public GlobalStringBuffer append(GlobalString s) {
+ {
+ if ((s.count+count) > value.length) {
+ // Need to allocate
+ char newvalue[] = new char[s.count+count+16]; //16 is DEFAULTSIZE
+ for(int i = 0; i < count; i++)
+ newvalue[i] = value[i];
+ for(int i = 0; i < s.count; i++)
+ newvalue[i+count] = s.value[i+s.offset];
+ value = newvalue;
+ count += s.count;
+ } else {
+ for(int i = 0; i < s.count; i++) {
+ value[i+count] = s.value[i+s.offset];
+ }
+ count += s.count;
+ }
+ }
+ return this;
+ }
+
+ public GlobalStringBuffer append(StringBuffer s) {
+ GlobalStringBuffer gsb;
+ {
+ gsb = new GlobalStringBuffer(s);
+ }
+ return append(gsb);
+ }
+
+
+ public GlobalStringBuffer append(GlobalStringBuffer s) {
+ {
+ if ((s.count+count) > value.length) {
+ // Need to allocate
+ char newvalue[] = new char[s.count+count+16]; //16 is DEFAULTSIZE
+ for(int i = 0; i < count; i++)
+ newvalue[i] = value[i];
+ for(int i = 0; i < s.count; i++)
+ newvalue[i+count] = s.value[i];
+ value = newvalue;
+ count += s.count;
+ } else {
+ for(int i = 0; i < s.count; i++) {
+ value[i+count] = s.value[i];
+ }
+ count += s.count;
+ }
+ }
+ return this;
+ }
+
+ public GlobalString toGlobalString() {
+ return new GlobalString(this);
+ }
+
+ public String toLocalString() {
+ GlobalString gstr = this.toGlobalString();
+ return gstr.toLocalString();
+ }
+
+}
MAINCLASS=FileSystem
-SRC1=${MAINCLASS}.java
+SRC1=${MAINCLASS}.java \
+ Directory.java \
+ DFile.java \
+ DistributedHashMap.java \
+ GlobalString.java \
+ GlobalStringBuffer.java \
+ DistributedLinkedList.java
FLAGS= -optimize -thread -mainclass ${MAINCLASS}
default:
../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC1}
*/\r
\r
public class FileSystem extends Thread {\r
- DistributedHashMap dir; // Directory \r
- DistributedHashMap fs; // File \r
- DistributedLinkedList dir_list;\r
- GlobalString inputfile;\r
- int mid;\r
- int threadid;\r
- \r
- public FileSystem(DistributedHashMap dir, DistributedHashMap fs, DistributedLinkedList dir_list) {\r
- this.dir = dir;\r
- this.fs = fs;\r
- this.dir_list = dir_list;\r
- }\r
- \r
- public FileSystem(DistributedHashMap dir, DistributedHashMap fs, DistributedLinkedList dir_list, String filename, int mid,int threadid) {\r
- this.dir = dir;\r
- this.fs = fs;\r
- this.dir_list = dir_list;\r
- this.mid = mid;\r
- this.threadid = threadid;\r
- this.inputfile = global new GlobalString("../data/"+filename + mid);\r
- }\r
+ Directory root;\r
+ Directory current;\r
+ int mid;\r
\r
+ public FileSystem(Directory root, int mid) {\r
+ this.root=root;\r
+ this.mid = mid;\r
+ }\r
\r
- public void setInputFileName(String filename, int mid) {\r
- this.mid = mid;\r
- this.inputfile = global new GlobalString("../data/"+filename + mid);\r
- }\r
-\r
- public void init() {\r
- fillHashTable();\r
- }\r
- \r
- public void fillHashTable() {\r
- GlobalString path;\r
- DistributedLinkedList list; \r
-\r
- atomic {\r
- path = global new GlobalString("/tmp/"); // root is 'tmp'\r
- list = global new DistributedLinkedList();\r
-\r
- dir.put(path, list);\r
- dir_list.add(path);\r
- }\r
- }\r
- \r
- public static void fillTodoList(String file, LinkedList todoList) {\r
- FileInputStream fis;\r
- String comm;\r
- char c;\r
- String key;\r
- String val;\r
- Transaction t;\r
-\r
- fis = new FileInputStream(file);\r
+ public void getRoot() {\r
+ current=root;\r
+ }\r
\r
- while ((comm = fis.readLine()) != null) { // 'command' 'path'\r
- c = comm.charAt(0); // ex) w /home/abc.c \r
- key = comm.subString(2);\r
- t = new Transaction(c, key);\r
- todoList.add(t);\r
- }\r
- }\r
+ public DFile getFile(GlobalString name) {\r
+ return current.getFile(name);\r
+ }\r
\r
- public void run() {\r
- System.out.println("Inside run method\n");\r
- Transaction t;\r
- char command;\r
- String key;\r
- String val;\r
- GlobalString gkey;\r
- GlobalString gval;\r
- boolean isDir;\r
+ public DFile createFile(GlobalString name) {\r
+ return current.createFile(name);\r
+ }\r
\r
- int index;\r
- String file;\r
+ public void run() {\r
+ long st = System.currentTimeMillis();\r
+ long fi;\r
+ atomic {\r
+ current=root.makeDirectory(global new GlobalString(String.valueOf(mid)));\r
+ }\r
+ Random r=new Random();\r
+ char ptr[]=new char[1024];\r
+ for(int i=0;i<40000;i++) {\r
atomic {\r
- System.out.println("trans1");\r
- file = inputfile.toLocalString();\r
- }\r
-\r
- System.out.println("file= " + file);\r
-\r
- LinkedList todoList = new LinkedList();\r
- fillTodoList(file, todoList);\r
-\r
- long st = System.currentTimeMillis();\r
- long fi;\r
- long tot1;\r
-\r
- if(todoList.isEmpty())\r
- System.out.println("todoList is Empty\n");\r
-\r
- int iter = 0;\r
- while (!todoList.isEmpty()) {\r
- //System.out.println("iter= " + iter + "\n");\r
- int count = 5;\r
- atomic {\r
- //System.out.println("trans2");\r
- while(count>0 && !todoList.isEmpty()) { //commit 5 transactions\r
- t = (Transaction)(todoList.removeFirst());\r
- if(t==null) {\r
- count--;\r
- continue;\r
- }\r
- command = t.getCommand();\r
- key = t.getKey();\r
- //System.out.println(key + "\n");\r
- gkey = global new GlobalString(key);\r
-\r
- index = key.lastindexOf('/');\r
- if (index+1 == key.length()) \r
- isDir = true;\r
- else \r
- isDir = false;\r
-\r
- long st1 = 0L;\r
- long fi1 = 0L;\r
- if (command == 'r') {\r
- st1 = System.currentTimeMillis();\r
- //System.out.println("["+command+"] ["+key+"]");\r
- if (isDir == true) {\r
- readDirectory(gkey);\r
- }\r
- else {\r
- readFile(gkey);\r
- }\r
- fi1 = System.currentTimeMillis();\r
- }\r
- tot1 += fi1 - st1;\r
- if (command == 'c') {\r
- //System.out.println("["+command+"] ["+key+"]");\r
- if (isDir == true) {\r
- createDirectory(gkey);\r
- }\r
- else {\r
- val = t.getValue();\r
- gval = global new GlobalString(val);\r
- createFile(gkey, gval);\r
- }\r
- }\r
- count--;\r
- }//end of inside loop\r
- }//end of atomic\r
- iter++;\r
- }\r
- fi = System.currentTimeMillis();\r
-\r
- // sleep(3000000);\r
- // atomic {\r
- // output();\r
- // }\r
-\r
- RecoveryStat.printRecoveryStat();\r
-\r
- System.out.println("\n\n\n I'm done - Time Elapse : "+ ((double)(fi-st)/1000) + "\n\n\n");\r
- System.out.println("\n Reading - Time Elapse : "+ ((double)tot1/1000) + "\n");\r
- while(true) {\r
- sleep(100000);\r
+ for(int count=0;count<10;count++) {\r
+ int value=r.nextInt(100);\r
+ GlobalString filename=global new GlobalString(String.valueOf(r.nextInt(200)));\r
+ if (value<10) {//10% writes\r
+ //System.out.println("Write: ");\r
+ //Do write\r
+ DFile f=getFile(filename);\r
+ if (f==null) {\r
+ f=createFile(filename);\r
+ }\r
+ f.write(10,ptr);\r
+ } else {\r
+ //System.out.println("Read: ");\r
+ //Do read\r
+ DFile f=getFile(filename);\r
+ if(f!=null)\r
+ f.read();\r
+ }\r
+ }\r
}\r
}\r
+ fi = System.currentTimeMillis();\r
+ RecoveryStat.printRecoveryStat();\r
+ System.out.println("\n\n\n I'm done - Time Elapse : "+ ((double)(fi-st)/1000) + "\n\n\n");\r
+ while(true) {\r
+ sleep(100000);\r
+ }\r
+ }\r
\r
- /*\r
- public void output() { \r
- Iterator iter;\r
- GlobalString gstr;\r
- iter = dir_list.iterator();\r
-\r
- while (iter.hasNext()) {\r
- gstr = (GlobalString)(iter.next());\r
- System.printString(gstr.toLocalString() + "\n");\r
- }\r
- }\r
- */\r
-\r
- public void readFile(GlobalString gkey) {\r
- GlobalString gval=null;\r
- String val=null;\r
-\r
- //atomic {\r
- gval = (GlobalString)(fs.get(gkey));\r
- if(gval!=null) {\r
- val = gval.toLocalString();\r
- //Add some useless extra work for now\r
- //to increase read time\r
- int hashVal = gval.hashCode();\r
- int a=0;\r
- for(int t=0; t<hashVal; t++) {\r
- for(int z=0; z<val.hashCode(); z++) {\r
- a = a + t + z;\r
- }\r
- }\r
- }\r
- //}\r
- if (val != null) {\r
- //System.out.println("<"+val+">");\r
- }\r
- else {\r
- //System.out.println("No such file or directory");\r
- }\r
- }\r
-\r
- public void readDirectory(GlobalString gkey) {\r
- DistributedLinkedList list;\r
- Iterator iter;\r
- GlobalString gval;\r
-\r
- list = (DistributedLinkedList)(dir.get(gkey));\r
-\r
- if (list != null) {\r
- iter = list.iterator();\r
- while (iter.hasNext() == true) {\r
- gval = (GlobalString)(iter.next());\r
- //System.out.print("["+gval.toLocalString()+"] ");\r
- //Add some useless extra work for now\r
- int hashVal = gval.hashCode();\r
- int a=0;\r
- for(int t=0; t<hashVal; t++) {\r
- a = a + t;\r
- }\r
- }\r
- //System.out.println("");\r
- }\r
- else {\r
- //System.out.println("No such file or directory");\r
- }\r
- }\r
-\r
- public void createFile(GlobalString gkey, GlobalString gval) {\r
- String path;\r
- String target;\r
- GlobalString gpath;\r
- GlobalString gtarget;\r
- int index;\r
- DistributedLinkedList list;\r
-\r
- index = gkey.lastindexOf('/');\r
- gpath = gkey.subString(0, index+1);\r
- gtarget = gkey.subString(index+1);\r
- //System.out.println(" createFile() gpath= " + gpath.toLocalString() + " gtarget= " + gtarget.toLocalString());\r
- if(dir==null)\r
- System.out.println("dir is null");\r
-\r
- if (dir.containsKey(gpath)) {\r
- //list = (DistributedLinkedList)(dir.get(gpath));\r
- //list.push(gtarget);\r
- //dir.put(gpath, list);\r
- fs.put(gkey, gval);\r
- }\r
- else {\r
- //System.out.println("Cannot create file");\r
- }\r
- }\r
-\r
- public void createDirectory(GlobalString gkey) {\r
- int index;\r
- GlobalString gpath;\r
- GlobalString gtarget;\r
- DistributedLinkedList list;\r
-\r
- index = gkey.lastindexOf('/', gkey.length()-2);\r
- //System.out.println("index= " + index + " gkey= " + gkey.toLocalString());\r
-\r
- if (index != -1) {\r
- gpath = gkey.subString(0, index+1);\r
- gtarget = gkey.subString(index+1);\r
- //System.out.println("createDirectory() gpath= " + gpath.toLocalString() + " gtarget= " + gtarget.toLocalString());\r
- if (dir.containsKey(gpath)) {\r
- //list = (DistributedLinkedList)(dir.get(gpath));\r
- //list.push(gtarget);\r
- //dir.put(gpath, list);\r
-\r
- list = global new DistributedLinkedList();\r
- dir.put(gkey, list);\r
- //System.out.println("Create directory");\r
- //dir_list.add(gkey);\r
- }\r
- else {\r
- //System.out.println("Cannot create directory");\r
- }\r
- }\r
- else {\r
- System.out.println("Cannot create directory");\r
- }\r
- }\r
- \r
- public Object read(DistributedHashMap mydhmap, GlobalString key) {\r
- Object obj = mydhmap.get(key); \r
- \r
- return obj;\r
- }\r
+ public static void main(String[] args) {\r
+ int NUM_THREADS = 3;\r
\r
- public static void main(String[] args) {\r
- int NUM_THREADS = 3;\r
- String filename = new String();\r
+ if (args.length == 1) {\r
+ NUM_THREADS = Integer.parseInt(args[0]);\r
+ }\r
+ else {\r
+ System.out.println("./FileSystem.bin master <num_thread>");\r
+ System.exit(0);\r
+ }\r
\r
- if (args.length == 2) {\r
- NUM_THREADS = Integer.parseInt(args[0]);\r
- filename = args[1];\r
- System.out.println("filename= " + filename);\r
- }\r
- else {\r
- System.out.println("./FileSystem.bin master <num_thread> <data>");\r
- System.exit(0);\r
+ int[] mid = new int[8];\r
+ mid[0] = (128<<24)|(195<<16)|(136<<8)|162;//dc-1\r
+ mid[1] = (128<<24)|(195<<16)|(136<<8)|163;//dc-2\r
+ mid[2] = (128<<24)|(195<<16)|(136<<8)|164;//dc-3\r
+ mid[3] = (128<<24)|(195<<16)|(136<<8)|165;//dc-4\r
+ mid[4] = (128<<24)|(195<<16)|(136<<8)|166;//dc-5\r
+ mid[5] = (128<<24)|(195<<16)|(136<<8)|167;//dc-6\r
+ mid[6] = (128<<24)|(195<<16)|(136<<8)|168;//dc-7\r
+ mid[7] = (128<<24)|(195<<16)|(136<<8)|169;//dc-8\r
+\r
+ FileSystem[] lus;\r
+ atomic {\r
+ Directory root=global new Directory(null);\r
+ lus = global new FileSystem[NUM_THREADS];\r
+ for(int i = 0; i < NUM_THREADS; i++) {\r
+ lus[i] = global new FileSystem(root, i);\r
}\r
+ }\r
\r
- int[] mid = new int[8];\r
- /*\r
- mid[0] = (128<<24)|(195<<16)|(180<<8)|21;//dw-2\r
- mid[1] = (128<<24)|(195<<16)|(180<<8)|26;//dw-7\r
- */\r
- mid[0] = (128<<24)|(195<<16)|(136<<8)|162;//dc-1\r
- mid[1] = (128<<24)|(195<<16)|(136<<8)|163;//dc-2\r
- mid[2] = (128<<24)|(195<<16)|(136<<8)|164;//dc-3\r
- mid[3] = (128<<24)|(195<<16)|(136<<8)|165;//dc-4\r
- mid[4] = (128<<24)|(195<<16)|(136<<8)|166;//dc-5\r
- mid[5] = (128<<24)|(195<<16)|(136<<8)|167;//dc-6\r
- mid[6] = (128<<24)|(195<<16)|(136<<8)|168;//dc-7\r
- mid[7] = (128<<24)|(195<<16)|(136<<8)|169;//dc-8\r
-\r
- FileSystem[] lus;\r
- FileSystem initLus;\r
-\r
+ FileSystem tmp;\r
+ /* Start threads */\r
+ for(int i = 0; i < NUM_THREADS; i++) {\r
atomic {\r
- DistributedHashMap fs = global new DistributedHashMap(500, 100, 0.75f);\r
- DistributedHashMap dir = global new DistributedHashMap(500, 100, 0.75f);\r
- DistributedLinkedList dir_list = global new DistributedLinkedList();\r
-\r
- initLus = global new FileSystem(dir, fs, dir_list);\r
- initLus.init();\r
-\r
- lus = global new FileSystem[NUM_THREADS];\r
- for(int i = 0; i < NUM_THREADS; i++) {\r
- lus[i] = global new FileSystem(initLus.dir, initLus.fs, initLus.dir_list, filename, i,mid[i]);\r
- }\r
- }\r
-\r
- FileSystem tmp;\r
- /* Start threads */\r
- for(int i = 0; i < NUM_THREADS; i++) {\r
- atomic {\r
- tmp = lus[i];\r
- }\r
- Thread.myStart(tmp, mid[i]);\r
+ tmp = lus[i];\r
}\r
+ Thread.myStart(tmp, mid[i]);\r
+ }\r
\r
- /* Join threads */\r
- for(int i = 0; i < NUM_THREADS; i++) {\r
- atomic {\r
- tmp = lus[i];\r
- }\r
- tmp.join();\r
+ /* Join threads */\r
+ for(int i = 0; i < NUM_THREADS; i++) {\r
+ atomic {\r
+ tmp = lus[i];\r
}\r
-\r
- System.printString("Finished\n");\r
+ tmp.join();\r
}\r
-}\r
-\r
-public class Transaction { // object for todoList\r
- char command; // r: read, w: write\r
- String key;\r
- String val;\r
-\r
- Transaction (char c, String key) {\r
- command = c;\r
-\r
- this.key = new String(key);\r
- this.val = new String();\r
- }\r
-\r
- Transaction (char c, String key, String val) {\r
- command = c;\r
-\r
- this.key = new String(key);\r
- this.val = new String(val);\r
- }\r
-\r
- public char getCommand() {\r
- return command;\r
- }\r
-\r
- public String getKey() {\r
- return key;\r
- }\r
\r
- public String getValue() {\r
- return val;\r
+ System.printString("Finished\n");\r
}\r
}\r
fillTodoList(file, todoList);\r
long st = System.currentTimeMillis();\r
long fi;\r
- long tot1, tot2;\r
+ long tot1=0, tot2=0;\r
\r
if(todoList.isEmpty())\r
System.out.println("todoList is Empty\n");\r
while (!todoList.isEmpty()) {\r
int count = 10;\r
atomic {\r
+ System.out.println("trans1, count= "+ count);\r
while(count>0 && !todoList.isEmpty()) { //commit 10 transactions\r
t = (Transaction)(todoList.removeFirst());\r
if(t==null) {\r
\r
if (command == 'r') {\r
long st1 = System.currentTimeMillis();\r
- //System.out.println("["+command+"] ["+key+"]");\r
+ System.out.println("["+command+"] ["+key+"]");\r
if (isDir != true) {\r
readFile(gkey);\r
}\r
\r
if (command == 'c') {\r
long st2 = System.currentTimeMillis();\r
- //System.out.println("["+command+"] ["+key+"]");\r
+ System.out.println("["+command+"] ["+key+"]");\r
if (isDir != true) {\r
String val = "Testrun";\r
GlobalString gval = global new GlobalString(val);\r
//System.out.println("readFile(): ["+gkey.toLocalString()+"] ");\r
//Add some useless extra work for now\r
//to increase read time\r
+ int[] b = new int[4096];\r
+ for(int i = 0; i< 4096; i++) {\r
+ b[i] = 0;\r
+ }\r
+ /*\r
String filename = gkey.toLocalString();\r
FileInputStream inputFile = new FileInputStream(filename);\r
int n;\r
}\r
}\r
inputFile.close();\r
+ */\r
/*\r
int hashVal = val.hashCode();\r
int a=0;\r
+++ /dev/null
-128.195.136.162
-128.195.136.163
-#128.195.136.164
-#128.195.136.165
-#128.195.136.166
-#128.195.136.167
-#128.195.136.168
-#128.195.136.169
MAINCLASS=FileSystem
-SRC1=${MAINCLASS}2.java \
- DistributedHashMap.java
+SRC1=${MAINCLASS}.java \
+ DistributedHashMap.java \
+ Directory.java \
+ DFile.java
FLAGS= -recovery -recoverystats -transstats -dsm -dsmcaching -debug -optimize -mainclass ${MAINCLASS}
DSMFLAGS=-transstats -dsm -dsmcaching -optimize -mainclass ${MAINCLASS}
default:
#define ROW 400 /* columns in the map */
#define COLUMN 100 /* rows of in the map */
-#define ROUNDS 2000 /* Number of moves by each player */
+#define ROUNDS 200 /* Number of moves by each player */
#define PLAYERS 20 /* Number of Players when num Players != num of client machines */
#define RATI0 0.5 /* Number of lumberjacks to number of planters */
#define BLOCK 3 /* Area around the gamer to consider */
Worker.java \
../../../../ClassLibrary/JavaDSM/RecoveryStat.java
-FLAGS=-recovery -recoverystats -transstats -dsm -dsmtask -prefetch -dsmcaching -32bit -debug -optimize -mainclass ${MAINCLASS} -excprefetch Task.isTodoListEmpty -excprefetch MatrixMultiply.output -excprefetch GlobalQueue.push -excprefetch MatrixMultiply.fillTodoList -excprefetch GlobalQueue.pop -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -excprefetch Work.checkCurrentWorkList -excprefetch MMul.getSum -excprefetch Task.grabTask -excprefetch Worker.Worker -excprefetch Task.dequeueTask -trueprob 0.96
+FLAGS=-recovery -recoverystats -dsm -dsmtask -prefetch -dsmcaching -32bit -optimize -mainclass ${MAINCLASS} -excprefetch Task.isTodoListEmpty -excprefetch MatrixMultiply.output -excprefetch GlobalQueue.push -excprefetch MatrixMultiply.fillTodoList -excprefetch GlobalQueue.pop -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -excprefetch Work.checkCurrentWorkList -excprefetch MMul.getSum -excprefetch Task.grabTask -excprefetch Worker.Worker -excprefetch Task.dequeueTask -excprefetch Worker.run -trueprob 0.96
DSMFLAGS= -dsm -dsmtask -transstats -dsmcaching -32bit -optimize -mainclass ${MAINCLASS} -excprefetch Task.isTodoListEmpty -excprefetch MatrixMultiply.output -excprefetch GlobalQueue.push -excprefetch MatrixMultiply.fillTodoList -excprefetch GlobalQueue.pop -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -excprefetch Work.checkCurrentWorkList -excprefetch MMul.getSum -excprefetch Task.grabTask
-RECOVERYFLAGS=-recovery -dsm -dsmtask -nooptimize -debug -mainclass ${MAINCLASS}
+RECOVERYFLAGS=-recovery -dsm -dsmtask -optimize -debug -mainclass ${MAINCLASS}
default:
../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC1}
128.195.136.162
+128.195.136.163
+128.195.136.164
+128.195.136.165
+128.195.136.166
+128.195.136.167
+128.195.136.168
+128.195.136.169
GString.java \
WhiplashSignature.java
-FLAGS= -prefetch -dsmcaching -dsm -recoverystats -recovery -optimize -mainclass ${MAINCLASS}
+FLAGS=-recovery -recoverystats -dsm -dsmcaching -prefetch -transstats -32bit -debug -optimize -mainclass ${MAINCLASS} -excprefetch HashStat.setuser -excprefetch String.hashCode -excprefetch String.equals -excprefetch HashStat.HashStat -excprefetch GString.toLocalCharArray -excprefetch SpamFilter.main -excprefetch HashEntry.getEngine -excprefetch HashEntry.getSignature -excprefetch HashStat.setuserid -excprefetch HashEntry.hashCode -excprefetch HashEntry.equals -excprefetch GString.GString -excprefetch SpamFilter.sendFeedBack -excprefetch HashStat.incSpamCount -excprefetch HashStat.incHamCount -trueprob 0.98
+DSMFLAGS=-dsm -dsmcaching -prefetch -transstats -32bit -optimize -mainclass ${MAINCLASS} -excprefetch HashStat.setuser -excprefetch String.hashCode -excprefetch String.equals -excprefetch HashStat.HashStat -excprefetch GString.toLocalCharArray -excprefetch SpamFilter.main -excprefetch HashEntry.getEngine -excprefetch HashEntry.getSignature -excprefetch HashStat.setuserid -excprefetch HashEntry.hashCode -excprefetch HashEntry.equals -excprefetch GString.GString -excprefetch SpamFilter.sendFeedBack -excprefetch HashStat.incSpamCount -excprefetch HashStat.incHamCount -trueprob 0.98
default:
../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
+# ../../../../buildscript ${DSMFLAGS} -o ${MAINCLASS}DSM ${SRC}
clean:
rm -rf tmpbuilddirectory*
-testcase 8 MatrixMultiply:1600 80
-testcase 8 Spider:"www.uci.edu" 4
-testcase 8 FileSystem:newdata
+testcase 8 MatrixMultiply:2048 80
+testcase 8 Spider:"dc-11.calit2.uci.edu" 10
+testcase 8 FileSystem:
testcase 8 SpamFilter:-e 500 -n 10
testcase 8 Game:
BASEDIR=`pwd`
RECOVERYDIR='recovery'
JAVASINGLEDIR='java'
-WAITTIME=75
-KILLDELAY=2
+WAITTIME=120
+KILLDELAY=10
LOGDIR=~/research/Robust/src/Benchmarks/Recovery/runlog
DSTMDIR=${HOME}/research/Robust/src/Benchmarks/Prefetch/config
MACHINELIST='dc-1.calit2.uci.edu dc-2.calit2.uci.edu dc-3.calit2.uci.edu dc-4.calit2.uci.edu dc-5.calit2.uci.edu dc-6.calit2.uci.edu dc-7.calit2.uci.edu dc-8.calit2.uci.edu'
0 8 7 3 6 5 4
0 7 4 6 8 1 2 );
-#ORDER=( 0 1 3 5 7 8 2 );
+#ORDER=( 0 1 8 4 6 3 7 );
#
# killClients <fileName> <# of machines>
runMachines log
sleep $WAITTIME
- killclientswithSignal $fName $2
+ killclientswithSignal $fName 8
#killclients $fName 8
sleep 10
cd -
if [ $k -eq 0 ]; then # if k = 0, it is a new test
if [ $test_iter -ne 1 ]; then
sleep $WAITTIME # wait the end of execution
- killclients $fName 8 # kill alive machines
+#killclients $fName 8 # kill alive machines
+ killclientswithSignal $fName 8 #kill machines when there is more than 1 order
outputIter=0;
for outputIter in 1 2 3 4 5 6 7 8
do
fi
done
+ sleep $WAITTIME # wait the end of execution
# killclients $fName 8 # kill alive machines
- killclientswithSignal $fName 8
+ killclientswithSignal $fName 8 #kill machines when finished processing everything in ORDER{ }
sleep 10
cd -
}
# javasingle 1 ${BM_NAME}
# cd $TOPDIR
# echo "================================================================================="
-#
-# echo "=============== Running recoverysingle for ${BM_NAME} on 1 machines ================="
-# recoverysingle 2 ${BM_NAME}
+
+# echo "=============== Running recoverysingle for ${BM_NAME} on 1 machines ================="
+# recoverysingle 1 ${BM_NAME}
# cd $TOPDIR
# echo "================================================================================="
-#
+
# echo "=============== Running dsmsingle for ${BM_NAME} on 1 machines ================="
# dsmsingle 1 ${BM_DSM}
# cd $TOPDIR
# echo "================================================================================="
-#
+
# echo "====================================== Recovery Execution Time ============================="
-# for count in 2 4 6 8
+# for count in 2 4 8
# do
# echo "------- Running $count threads $BM_NAME recovery on $count machines -----"
# runRecovery 1 $count ${BM_NAME}
# echo "================================================================================="
# echo "====================================== DSM Execution Time ============================="
-# for count in 2 4 6 8
+# for count in 2 4 8
# do
# echo "------- Running $count threads $BM_NAME dsm on $count machines -----"
# runDSM 1 $count $BM_DSM