The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "lk" <linux_kernel@patni.com>
To: "Banu R Reefath" <reefathbanur@myw.ltindia.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: Timers to threads
Date: Thu, 31 Mar 2005 03:28:36 -0800	[thread overview]
Message-ID: <001001c535e4$c79789e0$5e91a8c0@patni.com> (raw)
In-Reply-To: s24be47e.095@EMAIL

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/



      reply	other threads:[~2005-03-31 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-31  6:22 Timers to threads Banu R Reefath
2005-03-31 11:28 ` lk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001001c535e4$c79789e0$5e91a8c0@patni.com' \
    --to=linux_kernel@patni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reefathbanur@myw.ltindia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox