Home > Net > Hard drive speed will affect the rate of multithreading concurrent execution?
Hard drive speed will affect the rate of multithreading concurrent execution?
Time:10-05
Description and questions as follows: 1. The thread after startTrd in s1 s2 for two concurrent threads of execution, after the two threads are executed, the do somethings, then concurrent both threads, exit the loop until after the condition is met, 2. The phenomenon for this program and my laptop (and only the SSD) configuration about desktop computer (no SSD) running, running speed, for example, with the operation conditions, to run on my laptop to collect 300 points, only 100 or so on desktop, 3. In the process of collecting, hard drives will flash once in a while, guess is there. The.net environment thread is in the dynamic data read from the hard disk, thus caused the two computer configuration similar efficiency difference, 4. The.net mechanism is not very good, is there this kind of program (no hard disk IO operations) during execution will have the possibility of loading; Or Windows system is this: there will always be read threads exist, from time to time to read the hard disk operation, 5. If it is the influence of SSD, can run the program all the necessary code (including library code) all read into memory to avoid the program runs during loading?
Private OriDat dynData; Private bool ifEnd=false; Private MeasureResult MeasureResult=new MeasureResult (); Private void startBtn_Click (object sender, EventArgs e) { StartThread=new Thread (startTrd); StartThread. Start (new startCallBackDelegat (startTrdCallBack)); } Private void startTrd (object o) { List OriDats=new List (a); Motor. The start (" 500 "); MotorDelegate mDelegate=new motorDelegate (s2); LaserDelegate lDelegate=new laserDelegate (s1); IfEnd=false; Do { DynData=https://bbs.csdn.net/topics/new OriDat (); IAsyncResult m=mDelegate. The BeginInvoke (new AsyncCallback (s2Complete), mDelegate); IAsyncResult l=lDelegate. The BeginInvoke (new AsyncCallback (s1Complete), lDelegate); M. syncWaitHandle. WaitOne (); L.A. syncWaitHandle. WaitOne (); String pos=the string. Format (" {0: F4} ", dynData pos/10 m); OriDats. Add (dynData); This. Invoke (new EventHandler (delegate {textBox5. Text=dynData. Diameter [0]. TextBox6. Text=pos; })); } while (! Motor. IfStop2p & amp; & ! IfEnd); MeasureResult. OriDats=oriDats; As startCallBackDelegat startCallBackDelegat callBack="o. The callBack (); } Private void s1Complete (IAsyncResult iar) { Thread. The CurrentThread. Priority=ThreadPriority. The Highest; String [] ss=new string [2]. LaserDelegate task=(laserDelegate) iar. AsyncState; Ss=task. EndInvoke (iar); If (ss [0]=="999.9999" & amp; & Ss [1]=="999.9999") { Motor. The disable (); IfEnd=true; return; } DynData. Diameter [0]=the string. Format (" {0: F4} ", d1); DynData. Diameter [1]=the string. Format (" {0: F4} ", d2); } Private void s2Complete (IAsyncResult iar) { Thread. The CurrentThread. Priority=ThreadPriority. The Highest; MotorDelegate task=(motorDelegate) iar. AsyncState; DynData. Pos=task. EndInvoke (iar); } Private string [] (s1) { Thread. The CurrentThread. Priority=ThreadPriority. The Highest; The return laser. The getValue (); } Private decimal s2 () { Thread. The CurrentThread. Priority=ThreadPriority. The Highest; Return motor. The pos (); }
CodePudding user response:
Will, disk I/o is fixed, such as 7200 turn 10000 turn, general program is hard to exceed the throughput, if you really can use SSD is not assured