Connecting Tech Pros Worldwide Forums | Help | Site Map

System.Threading.Timer - A few questions

steve
Guest
 
Posts: n/a
#1: Nov 17 '05
Since System.Threading.Timer uses the threadpool to do its stuff what happens
when

(a) You try to create a timer and the thread pool is *exhausted*
(b) The timer is due to fire AND all threads in the threadpool are blocked
(deadlocked maybe)?

As a followup qn to this.. (please excuse my ignorance here) Is there one
threadpool per process or one threadpool for the *virtual machine* (ie
runtime environment, sorry haven't got a diploma in .net three letter
acronyms ; )

Cheers,

-- Steve


Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Nov 17 '05

re: System.Threading.Timer - A few questions


Steve,

When you create a timer, it doesn't actually do anything. The
threadpool is used only when the timer is calling back

When you say the thread pool is exhausted, do you mean all the threads
are currently running or they are all in deadlock? Like any other task that
gets put into the thread pool when all available threads are running, the
task is queued, and it waits for an open thread before it is processed.

If the timer is due to fire, and all of the threads are deadlocked, then
you have bigger issues.

What are you trying to acheive here?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"steve" <steve@discussions.microsoft.com> wrote in message
news:C74164D1-79FA-4717-9777-07CE8848E716@microsoft.com...[color=blue]
> Since System.Threading.Timer uses the threadpool to do its stuff what
> happens
> when
>
> (a) You try to create a timer and the thread pool is *exhausted*
> (b) The timer is due to fire AND all threads in the threadpool are blocked
> (deadlocked maybe)?
>
> As a followup qn to this.. (please excuse my ignorance here) Is there one
> threadpool per process or one threadpool for the *virtual machine* (ie
> runtime environment, sorry haven't got a diploma in .net three letter
> acronyms ; )
>
> Cheers,
>
> -- Steve
>[/color]


steve
Guest
 
Posts: n/a
#3: Nov 17 '05

re: System.Threading.Timer - A few questions


Thanks Nicholas,

The motivation behind the question is..

If I use a threading.timer for regular short repetitive actions (ie reading
a FIFO exposed by and FPGA on USB connected hardware), are there any
circumstances when the timer will not fire.

(a) Is it possible for a threading.timer NOT to fire? (ans. yes ==> all
threadpool threads deadlocked)
(b) What happens if it doesn't fire? Don't know. Exceptions?
(c) Are there any metrics on timing jitter as a function of threadpool
loading?

Cheers

-- Steve

"Nicholas Paldino [.NET/C# MVP]" wrote:
[color=blue]
> Steve,
>
> When you create a timer, it doesn't actually do anything. The
> threadpool is used only when the timer is calling back
>
> When you say the thread pool is exhausted, do you mean all the threads
> are currently running or they are all in deadlock? Like any other task that
> gets put into the thread pool when all available threads are running, the
> task is queued, and it waits for an open thread before it is processed.
>
> If the timer is due to fire, and all of the threads are deadlocked, then
> you have bigger issues.
>
> What are you trying to acheive here?
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
> "steve" <steve@discussions.microsoft.com> wrote in message
> news:C74164D1-79FA-4717-9777-07CE8848E716@microsoft.com...[color=green]
> > Since System.Threading.Timer uses the threadpool to do its stuff what
> > happens
> > when
> >
> > (a) You try to create a timer and the thread pool is *exhausted*
> > (b) The timer is due to fire AND all threads in the threadpool are blocked
> > (deadlocked maybe)?
> >
> > As a followup qn to this.. (please excuse my ignorance here) Is there one
> > threadpool per process or one threadpool for the *virtual machine* (ie
> > runtime environment, sorry haven't got a diploma in .net three letter
> > acronyms ; )
> >
> > Cheers,
> >
> > -- Steve
> >[/color]
>
>
>[/color]
Closed Thread