event scheduler

Posted on 2006-04-14
Last Modified: 2010-04-01
I'm working on a program that controls a machine in which the program tells the machine to do tasks.  Sometimes the tasks will need to happen close to the same time and we are using threads to do that.  I want to know how windows xp's event scheduler handles the task and what tasks a barebones xp with just our software on it will run.  I'm trying to get an idea of timing because if xp starts some task that won't let our program run for a long period of time then we might have issues and might have to change OS's maybe to a real time OS.  Can anyone give me some input to the matter or a link where I can find it.  So far I have done some testing get times between sending and receiving communications and at first glances it looks fine but are there things or windows events that I'm missing that might cause problems.
Question by:docieb
    LVL 86

    Accepted Solution

    by: ("High-Precision Timing Under Windows, Windows NT, & Windows 95") sums that up pretty nicely:


    The multithreaded environments of Windows NT and Windows 95 employ CPU scheduling techniques to improve processor utilization and smooth multitasking. The portions of code, called threads, within the system are organized into queues and assigned priorities. Threads of code required by the operating system are assigned high priorities. The thread scheduler allows a thread a predetermined amount of execution time (quantum). Then it evicts the thread from the processor until all threads at the specific priority level have been serviced. The process continues at the next, lower, priority level. The timer-servicing thread, like applications, is subject to CPU scheduling and eviction regardless of the thread priority. Given that the number of threads ready for execution changes frequently, the period between timer thread executions can vary dramatically.

    For example, say five time-critical threads are ready for execution, and the quantum is q milliseconds. If the timer thread is fifth, four threads execute before the timer thread is executed; q milliseconds x 4. This means that if q is 25 milliseconds, 100 milliseconds will have elapsed before the fifth thread is executed. Boosting the priority of the thread that created the timer risks introducing instability in the system by starving the time-sensitive, system-critical threads.


    The same applies to XP also. So, if you don's have anything else running on the machine, you should be on the safe side unless you need timing intervals that are way below 10ms.
    LVL 11

    Assisted Solution

    I don't think you will face any problem unless your application and any scheduled application uses a common resource like a file.

    simple example: try to open file which is currenlty getting scanned by the any virus scanners.It will take a little while since the virus scannersare holding those files.Make sure you don't have any dependencies like these.Other wise windows is multithreaded/multitasking OS.

    Best regards,

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Live - One-on-One C++ Help from Top Experts

    Solve your toughest problems, fast.
    C++ experts are online now and ready to help you.

    Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
    Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now