public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Reinelt <reinelt@eunet.at>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: nanosleep question
Date: Wed, 07 Mar 2001 11:05:27 +0100	[thread overview]
Message-ID: <3AA607E7.6B94D2D@eunet.at> (raw)

Hi,

I've got a question regarding the nanosleep() system call.

I'm writing a little tool called lcd4linux
(http://lcd4linux.sourceforge.net), where I have to drive displays
connected to the parallel port. I'm doing this in userland, using
outb().

Some of this displays require quite short delays (e.g. 40 microseconds),
which cannot be done with normal nanosleep() because of the 10 msec
timer resolution.

At the moment I implemented by own delay loop using a small assembler
loop similar to the one used in the kernel. This has two disadvantages:
assembler isn't that portable, and the loop has to be calibrated.

I took a look at the nanosleep() implementation in the kernel, and found
that it is possible to get very small delays, but only if I set the
scheduling type to SCHED_RR or SCHED_FIFO.

Here are my questions:

- why are small delays only possible up to 2 msec? what if I needed a
delay of say 5msec? I can't get it?

- how dangerous is it to run a process with SCHED_RR? As far as I
understood the nanosleep man page, it _is_ dangerous (if the process
gets stuck in an endless loop, you can't even kill it if you don't have
a shell which has a higher static priority than the stuck process
itself).

- is it possible to switch between different scheduling modes? I cound
run the program with normal SCHED_OTHER, and switch to SCHED_RR whenever
I need to write data to the parallel port? Does this make sense?

- what's the reason why these small delays is not possible with
SCHED_OTHER?


TIA, 
     Michael

-- 
netWorks       	                                  Vox: +43 316  692396
Michael Reinelt                                   Fax: +43 316  692343
Geisslergasse 4					  GSM: +43 676 3079941
A-8045 Graz, Austria			      e-mail: reinelt@eunet.at

             reply	other threads:[~2001-03-07 10:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-07 10:05 Michael Reinelt [this message]
2001-03-09 20:01 ` nanosleep question george anzinger
2001-03-10  7:19   ` Michael Reinelt
2001-03-10 10:03     ` george anzinger
2001-03-11 11:20       ` Michael Reinelt

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=3AA607E7.6B94D2D@eunet.at \
    --to=reinelt@eunet.at \
    --cc=linux-kernel@vger.kernel.org \
    /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