DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 7 of 7

Thread: Thread Priority

  1. #1
    LN Guest

    Thread Priority


    I am running a process that is sending data trough an interface but it seems
    that windows NT interrupts
    the communication, messing up the spacing between data blocks. Is there anything
    I can change in my
    software that can stop windows NT from interrupting when data is being transfered?

  2. #2
    Andy Friedman Guest

    Re: Thread Priority

    Not sure I understand the question. Are you saying that the timing of
    receiving your data is so sensitive, that normal CPU rotation caused by the
    OS thread scheduler is screwing up your data? Please explain.

    Andy

    "LN" <lnarvaez@west.raytheon.com> wrote in message
    news:3a251005$1@news.devx.com...
    >
    > I am running a process that is sending data trough an interface but it

    seems
    > that windows NT interrupts
    > the communication, messing up the spacing between data blocks. Is there

    anything
    > I can change in my
    > software that can stop windows NT from interrupting when data is being

    transfered?



  3. #3
    LN Guest

    Re: Thread Priority


    I am sending the data and there has to be a fixed amount of time between data
    blocks. The data is
    coming out of a file. I can send many blocks of data without any problem
    but every once in a while a
    data block will have to be sent again because the timing was not right and
    the receiving system would
    not return a good response to my application. We were able to see the data
    on a logical analyzer when
    this error happened and the spacing between the blocks was sometimes more
    than twice what the
    receiving system was expecting. We think that the OS is interrupting in the
    middle of a transmition
    delaying our timing whish is just a couple of milliseconds.

    "Andy Friedman" <devxnews@zr1.com> wrote:
    >Not sure I understand the question. Are you saying that the timing of
    >receiving your data is so sensitive, that normal CPU rotation caused by

    the
    >OS thread scheduler is screwing up your data? Please explain.
    >
    >Andy
    >
    >"LN" <lnarvaez@west.raytheon.com> wrote in message
    >news:3a251005$1@news.devx.com...
    >>
    >> I am running a process that is sending data trough an interface but it

    >seems
    >> that windows NT interrupts
    >> the communication, messing up the spacing between data blocks. Is there

    >anything
    >> I can change in my
    >> software that can stop windows NT from interrupting when data is being

    >transfered?
    >
    >



  4. #4
    chris Guest

    Re: Thread Priority


    well, the short answer is yes.

    immediately prior to sending data, bump up the priority with setpriorityclass
    and setthreadpriority. the highest values being REALTIME_PRIORITY_CLASS/THREAD_PRIORITY_TIME_CRITICAL
    which would cause your thread to preempt even os tasks such as flushing disk
    caches etc.

    this is what you are asking - to have your thread not be interrupted by ANYTHING
    - even the os.

    if you do this however, be very careful. if you remain in this high priority
    state too long, nothing will respond - mouse, keyboard, anything. as a result,
    i would certainly wrap up such a priority shift within an RAI to ensure its
    reset to a lower class/priority at the appropriate time.

    now, that said, i would highly question such a design move. implementing
    a data protocol dependent on such finely grained timing (a couple of ms)
    on a non-hard real time os is not the best move (imho).

    "LN" <lnarvaez@west.raytheon.com> wrote:
    >
    >I am sending the data and there has to be a fixed amount of time between

    data
    >blocks. The data is
    >coming out of a file. I can send many blocks of data without any problem
    >but every once in a while a
    >data block will have to be sent again because the timing was not right and
    >the receiving system would
    >not return a good response to my application. We were able to see the data
    >on a logical analyzer when
    >this error happened and the spacing between the blocks was sometimes more
    >than twice what the
    >receiving system was expecting. We think that the OS is interrupting in

    the
    >middle of a transmition
    >delaying our timing whish is just a couple of milliseconds.
    >
    >"Andy Friedman" <devxnews@zr1.com> wrote:
    >>Not sure I understand the question. Are you saying that the timing of
    >>receiving your data is so sensitive, that normal CPU rotation caused by

    >the
    >>OS thread scheduler is screwing up your data? Please explain.
    >>
    >>Andy
    >>
    >>"LN" <lnarvaez@west.raytheon.com> wrote in message
    >>news:3a251005$1@news.devx.com...
    >>>
    >>> I am running a process that is sending data trough an interface but it

    >>seems
    >>> that windows NT interrupts
    >>> the communication, messing up the spacing between data blocks. Is there

    >>anything
    >>> I can change in my
    >>> software that can stop windows NT from interrupting when data is being

    >>transfered?
    >>
    >>

    >



  5. #5
    Andy Friedman Guest

    Re: Thread Priority

    >
    > now, that said, i would highly question such a design move. implementing
    > a data protocol dependent on such finely grained timing (a couple of ms)
    > on a non-hard real time os is not the best move (imho).
    >


    My thoughts exactly.

    Andy



  6. #6
    Danny Kalev Guest

    Re: Thread Priority



    Andy Friedman wrote:
    >
    > >
    > > now, that said, i would highly question such a design move. implementing
    > > a data protocol dependent on such finely grained timing (a couple of ms)
    > > on a non-hard real time os is not the best move (imho).
    > >

    >
    > My thoughts exactly.


    I second that too:-)

    Danny

  7. #7
    Jim Howard Guest

    Re: Thread Priority


    You might consider porting your application to run under a real time operating
    system. I have implemented time critical applications under DOS using some
    hacks, but I'd never try it under windows. Your only hope is to boost your
    thread priority to the max and hope that windows doesn't crash as a result.

    You might look at getting a single board computer to plug into a host pc.
    Your NT box could control the overall operation, and the single board computer
    could do the time-critical communications.

    If you have to analyse your output on a scope then you shouldn't be using
    Windows. Windows is a great OS, but it's not an RTOS.

    Jim



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links