Timer resources

  • Thread starter Thread starter Bob Day
  • Start date Start date
B

Bob Day

Using VS 2003, VB, MSDE...

I find myself using timers alot. Dosystem times or Thread times carry a
much of a resource cost? Or is the cost negligible? It seems to be little
resource cost.

Thanks.

Bob Day
 
Hi Bob,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you create a lot of timers(Is the
timer a System.Threading.Timer or System.Timers.Timer ) under in your
projects, and you want to know if the System.Threading.Timer or
System.Timers.Timer consumed a lof of system resource?
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

Here is a few articles about Timer, you may take a look.

Practical Multithreading for Client Apps
http://msdn.microsoft.com/msdnmag/issues/04/01/net/default.aspx

Timers
Comparing the Timer Classes in the .NET Framework Class Library
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx

If you have any concern on this issue, please post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks - the articles were very helpful. But my question still stands.

Are System.Timers.Timer resource intensive to use? That is the only timers
I use a lot of, and I think the answer is no.

Bob Day
 
Hi,

Timers ARE NOT resource intensive.

Naturally, this does not mean that they do not use resources. For example,
System.Timers.Timer uses a worker thread from the thread pool. By default,
the thread pool is 25 threads, so if you need more, or have other classes
that create threads from the pool, you will have to change this default.
Beyond that, I suppose that one could measure other statistics when timers
are created to come up with some numbers -- at the end of the day, I'm not
sure what they would mean.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Back
Top