// Start the process, and create and manage threads public void initiate() { int numOfTermsInPosting = 50 * 1000; idxr = new Indexer(cacheSize, heapSize, numOfTermsInPosting, _posting_path); foreach (string file in Directory.GetFiles(_batch_path)) if (!file.Equals("stop_words.txt")) insertBatch(file); Task status = Task.Run(() => { read_data(); }); /*for (int i = 0; i < 2; i++) readFileAsync(); parserAsync();*/ readFileTasks = new Task[num_of_threads_readFile]; for (int i=0; i< num_of_threads_readFile; i++) { Task readfile = Task.Run(() => { startReadFile(); }); readFileTasks[i] = readfile; } parserTasks = new Task[num_of_threads_Parser]; for (int i = 0; i < num_of_threads_Parser; i++) { Task parser = Task.Run(() => { startParser(); }); parserTasks[i] = parser; } Task indexer = Task.Run(() => { startindexer(cacheSize, heapSize); }); Task waitReadFile = Task.Run(() => { waitforReadFileProcess(readFileTasks); }); Task waitParser = Task.Run(() => { waitforparserProcess(parserTasks); }); Task waitIndexer = Task.Run(() => { waitforindexerProcess(indexer); }); }
public void load_memory(string path) { if (idxr == null) idxr = new Indexer(cacheSize, heapSize, 20000, path); idxr.load_memory(); }