/// <summary> /// конструктор /// </summary> public Manager(string[] _args) { args = _args; thr = new Thread(this.parse); //threadscount = Environment.ProcessorCount; int mgbt = Int32.Parse(args[2]); if (mgbt < 5) { mgbt = 5; } int avmem = Convert.ToInt32(mgbt * 0.65); // Mb int thr1 = Convert.ToInt32((avmem * 1024) / 2300); // Mb for 1 thread int linecount = Convert.ToInt32(avmem * 2500 / 2300); // тыс строк на один поток threadscount = 1; FileInfo fi = new FileInfo(args[0]); int szm = Convert.ToInt32(fi.Length / (1024 * 1024)); // Mb int kf = (szm / thr1); kf++; if (kf > Environment.ProcessorCount) { kf = Environment.ProcessorCount; } threadscount = threadscount * kf; linecount = linecount * 1000 / kf; threads = new IBigSortThread[threadscount]; QManager = Factories.CreateQueueManager(threadscount, linecount); }
public BigSortThread(IBigSortManagerQueue _queue) { cthr = new Thread(this.run); bsqueue = _queue; cthr.Name = "compressorthread"; outdata = new SortedSet <bsdata>(); }
/// <summary> /// конструктор /// </summary> public BigSortReader(string _filename_in, IBigSortManagerQueue _Queue) { cthr = new Thread(this.DoRead); filename_in = _filename_in; sortQueue = _Queue; }
// читающий поток public static IBigSortThread CreateBigSortReader(IBigSortManagerQueue _queue, string _filename) { return(new BigSortReader(_filename, _queue)); }
// рабочие потоки public static IBigSortThread CreateBigSortThread(IBigSortManagerQueue _queue) { return(new BigSortThread(_queue)); }
// пишущий поток public static IBigSortThread CreateBigSortWriter(IBigSortManagerQueue ComMan) { return(new Writer(ComMan)); }
public Writer(IBigSortManagerQueue _writer) { writerthread = new Thread(this.run); bigsortwriter = _writer; writerthread.Name = "Writer"; }