All of lore.kernel.org
 help / color / mirror / Atom feed
* Timers to threads
@ 2005-03-31  6:22 Banu R Reefath
  2005-03-31 11:28 ` lk
  0 siblings, 1 reply; 2+ messages in thread
From: Banu R Reefath @ 2005-03-31  6:22 UTC (permalink / raw)
  To: linux-kernel

 Dear Sir/Mam
  We are using Linux in one of our embedded products.This is the first time we are  working in this Platform.We have few doubts regarding implementing s/w timers & how  to pass the  timer interrupts to threads .
 In net we coudnt find exactly what we want .Could you please help us in this regard?

Ideas from us
1. If we want a thread to execute at particular intervals should it be done only through 
usleep()  system call ? Will it be accurate enough ? 
Because it is a real time design for a Medical Product.

2. If we use kernel timers to invoke at particular time intervals using add_timer () how to  pass on to the application that the time has elapsed?

A piece of code demonstartion would be much more helpful to us 

Thanks & Regards,
Reefath Banu Rajali
Software Engineer
Larsen & Toubro 
Embedded Systems & Software
Mysore
India



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Timers to threads
  2005-03-31  6:22 Timers to threads Banu R Reefath
@ 2005-03-31 11:28 ` lk
  0 siblings, 0 replies; 2+ messages in thread
From: lk @ 2005-03-31 11:28 UTC (permalink / raw)
  To: Banu R Reefath, linux-kernel

If u search for usleep in google then first document says that usleep will
have max range of 1,000,000 microseconds as the max sleep delay and
after the delay time expires the actual execution may get delayed because
of high system activity.

If you are writing kernel modules, you may  use schedule_timeout().
schedule_timeout() uses dynamic timers and when schedule( ) is invoked,
another process
is selected for execution; when the former process resumes its execution,
the function
schedule_timeout removes the dynamic timer.

code snippet
for(;;){
  set_current_state(TASK_UNINTERRUPTIBLE);
  schedule_timeout(unsigned long timeout); /* schedule_timeout(10*HZ) will
suspend process & resume execution after 10 seconds */
  set_current_state(TASK_RUNNING);
}
hope it helps
regards
lk
----- Original Message ----- 
From: "Banu R Reefath" <reefathbanur@myw.ltindia.com>
To: <linux-kernel@vger.kernel.org>
Sent: Wednesday, March 30, 2005 10:22 PM
Subject: Timers to threads


> Dear Sir/Mam
>   We are using Linux in one of our embedded products.This is the first
time we are  working in this Platform.We have few doubts regarding
implementing s/w timers & how  to pass the  timer interrupts to threads .
>  In net we coudnt find exactly what we want .Could you please help us in
this regard?
>
> Ideas from us
> 1. If we want a thread to execute at particular intervals should it be
done only through
> usleep()  system call ? Will it be accurate enough ?
> Because it is a real time design for a Medical Product.
>
> 2. If we use kernel timers to invoke at particular time intervals using
add_timer () how to  pass on to the application that the time has elapsed?
>
> A piece of code demonstartion would be much more helpful to us
>
> Thanks & Regards,
> Reefath Banu Rajali
> Software Engineer
> Larsen & Toubro
> Embedded Systems & Software
> Mysore
> India
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-31 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-31  6:22 Timers to threads Banu R Reefath
2005-03-31 11:28 ` lk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.