Lytus Posted November 1, 2006 Posted November 1, 2006 Is there a way with AutoIT to prevent context switches in windows?? I've looked around a bit and cant find one.
GaryFrost Posted November 1, 2006 Posted November 1, 2006 I'm guessing this is what you mean? http://www.autoitscript.com/forum/index.ph...st&p=252091 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Valik Posted November 1, 2006 Posted November 1, 2006 The way you do it is the same in AutoIt as it is in any other program on Windows. If you want your thread/process to have higher priority, you have to increase the thread/process priority. For those not familiar with the terminology, context switching is what occurs when the kernel switches from one thread to another. "Atomic code" would be code that would be guaranteed to run from start to end before a context switch is done.
Lytus Posted November 1, 2006 Author Posted November 1, 2006 Thank you for the response, Valik.I was hoping there was a code version of this in AutoIT rather than physically going to the task manager and increasing the process's priority, because I'd like a particular segment of the code to be atomic and not the whole program. If I would have to write my own C or C++ code to do this then it may be easier to just change the priority and adjust my program accordingly.My apologies if some folks didn't understand what I meant in the question. Valik gave a great response. For anybody interested, you can read about it here: http://en.wikipedia.org/wiki/Context_switch. This is useful if you have an event-driven program, where the environment is changing (like a bot for a game GUI), and the program does the right thing 99% of the time and a seriously wrong thing 1% of the time. This occurs because your program could be finished processing the GUI and starting on your program's response, when a context switch happens and the game changes state. Your program will execute based on the erroneus game state, and the affects can range from not noticable to train wreck.
Lytus Posted November 1, 2006 Author Posted November 1, 2006 (edited) Oh, my 1% chance is Train Wreck! Edited November 1, 2006 by Lytus
GaryFrost Posted November 1, 2006 Posted November 1, 2006 Have you tried ProcessSetPriority ( "process", priority) ? SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Lytus Posted November 1, 2006 Author Posted November 1, 2006 That should work! My last question: I am unfamiliar with window's process priority. Will setting it to realtime be guaranteed to prevent it from switching to any other program with normal(default) priority?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now