Re: processor time allocation
- From: "Steve Muccione" <home*DOT*muccione@xxxxxxxxxxx>
- Date: Thu, 31 Mar 2005 17:33:53 GMT
I don't believe that you're starved... if the thread is in the run list then
it WILL get executed.
When an app is doing IO it does NOT show up in the task manager as process
cpu time... quite likely it will not even show up under kernel time either..
most likely it is waiting for a driver to alert it that an IO operation is
complete (the driver is subsequently waiting on a HW interrupt or some
such).
I strongly suspect that your process is doing I/O and is subsequently
PENDING completion of the I/O operation and NOT cycle starved (it's getting
all it wants).
You might want to try caching writes until you have a large amount and
writing it out all at once.
Alternatly, a flow model would be helpfull in diagnosing you problem...
simply stating that my process is not getting cpu time really doesn't give
us much to go on.
steve
"RossD @ Cadwell" <RossDCadwell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2ACB36BC-889D-420D-911E-1C67E3786B07@xxxxxxxxxxxxxxxx
> The 20 HZ thread is not really my issue. If that were my only thread (if
> it
> were the only data processing that was occurring in the system) then it
> works
> perfectly fine using Sleep to obtain a near 20 Hz frequency.
>
> I did implement Michael's suggestion with the event and wait for object as
> you mentioned.
>
> And although it does make that thread run smoother, it does not resolve my
> major issue.
> Which is that my App is CPU starved and windows wont give my app more than
> 30% CPU time.
>
> Please read my reply to Michael above.
>
>
>
> "Scott McPhillips [MVP]" wrote:
>
>> RossD @ Cadwell wrote:
>>
>> > My app routinely only gets 10 to 30 % of CPU time - the system idle
>> > process
>> > gets the rest (indicated by windows task manager)
>> >
>> > My app is multithreaded and has one thread that requires lots of CPU
>> > time at
>> > 20 Hz intervals. I sleep this thread for an amount of time that would
>> > put it
>> > at the next 20 Hz interval. My other threads sleep when they are not
>> > busy.
>> >
>> > My 20 Hz thread does not recieve the processor time that it needs -
>> > even
>> > though the system idle process is taking up 70 to 90 % of the CPU time.
>> >
>> > If I remove the sleep call from my 20 Hz thread then it hogs all of the
>> > CPU
>> > time and the system idle time goes down to near zero.
>> >
>> > How do I balance this? Why does the operating system horde all of the
>> > CPU
>> > time when my thread sleeps?
>> >
>> > Ross D
>> > RossD@xxxxxxxxxxx
>> >
>>
>> Your computation of the Sleep time, and/or the coarse resolution of the
>> system clock, both probably contribute to the inaccuracy. Windows will
>> give up idle time if your thread can run. Your thread cannot run until
>> the (crude) Sleep time expires.
>>
>> As Michael suggests, you can get more precise timing by using the
>> multimedia timer instead of Sleep. See timeSetEvent with an event
>> handle that you get by calling CreateEvent. Then replace your Sleep
>> call with a WaitForSingleObject call on the event handle.
>>
>> --
>> Scott McPhillips [VC++ MVP]
>>
>>
.
- Prev by Date: Re: Delete 2 bytes from a file
- Next by Date: Re: editable and dynamic height
- Previous by thread: Re: processor time allocation
- Next by thread: Re: processor time allocation
- Index(es):
Relevant Pages
|