Re: MDELAY()

2005-04-15 Thread Dipjyoti Saikia
Hi,

DELAY() in FreeBSD uses a busy loop . I am looking for something like
sleep_on_timeout() call in Linux . (dont' want to waste the CPU cycles
by  DELAY'ing)

As I am pretty new to programming with Free BSD ,  can you help me
with  some details about equivalent implementation(wait queues etc) in
Free BSD .

---Dip


On 4/13/05, Brooks Davis [EMAIL PROTECTED] wrote:
 On Wed, Apr 13, 2005 at 02:33:22AM +0530, Dipjyoti Saikia wrote:
  Hi,
 
  Can any one help me out with a better Implementation of MDELAY() in
  FreeBSD kernel 4.10
 
 Please start by defining better.
 
 -- Brooks
 
 --
 Any statement of the form X is the one, true Y is FALSE.
 PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
 
 

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: MDELAY()

2005-04-15 Thread Daniel O'Connor
On Fri, 15 Apr 2005 21:46, Dipjyoti Saikia wrote:
 DELAY() in FreeBSD uses a busy loop . I am looking for something like
 sleep_on_timeout() call in Linux . (dont' want to waste the CPU cycles
 by  DELAY'ing)

tsleep/msleep/timeout are probably what you want.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


pgpZBDhyMCe8D.pgp
Description: PGP signature


Re: MDELAY()

2005-04-15 Thread ALeine
[EMAIL PROTECTED] wrote: 

 DELAY() in FreeBSD uses a busy loop . I am looking for something
 like sleep_on_timeout() call in Linux . (dont' want to waste the CPU
 cycles by  DELAY'ing)

You may want to check out timeout(9) / untimeout(9), see man 9 timeout
for details.
 
 As I am pretty new to programming with Free BSD ,  can you help
 me with some details about equivalent implementation(wait queues
 etc) in Free BSD .

Reading the man pages for asleep(9) / wakeup(9) should give you a
good introduction.

ALeine
___
WebMail FREE http://mail.austrosearch.net 
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: MDELAY()

2005-04-15 Thread Joseph Koshy
 sleep_on_timeout() call in Linux . (dont' want to waste the CPU cycles

You may want to try the manual pages.

% man -k sleep | fgrep '(9)'  
endtsleep(9), sleepinit(9), unsleep(9) - manage the queues of sleeping processes
init_sleepqueues(9) ... sleepq_wait_sig(9) - manage the queues of
sleeping threads
sleep(9), msleep(9), tsleep(9), wakeup(9) - wait for events
vm_page_sleep_busy(9)- wait for a busy page to become unbusy

% man -k DELAY | fgrep '(9)'
DELAY(9) - busy loop for an interval

-- 
FreeBSD Volunteer, http://people.freebsd.org/~jkoshy
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: MDELAY()

2005-04-15 Thread Joerg Sonnenberger
On Fri, Apr 15, 2005 at 06:03:11AM -0700, ALeine wrote:
 [EMAIL PROTECTED] wrote: 
 
  DELAY() in FreeBSD uses a busy loop . I am looking for something
  like sleep_on_timeout() call in Linux . (dont' want to waste the CPU
  cycles by  DELAY'ing)
 
 You may want to check out timeout(9) / untimeout(9), see man 9 timeout
 for details.

You should not use timeout(9) without a very good reason, the callout_*
interface is prefered.

Joerg
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: MDELAY()

2005-04-15 Thread Daniel O'Connor
On Sat, 16 Apr 2005 00:34, Joerg Sonnenberger wrote:
  You may want to check out timeout(9) / untimeout(9), see man 9 timeout
  for details.

 You should not use timeout(9) without a very good reason, the callout_*
 interface is prefered.

Can someone add a warning to the top of the makefile similar to the one for 
spl?

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


pgpGG3Fv9PUgX.pgp
Description: PGP signature


Re: MDELAY()

2005-04-15 Thread Joerg Sonnenberger
On Sat, Apr 16, 2005 at 01:12:42AM +0930, Daniel O'Connor wrote:
 On Sat, 16 Apr 2005 00:34, Joerg Sonnenberger wrote:
   You may want to check out timeout(9) / untimeout(9), see man 9 timeout
   for details.
 
  You should not use timeout(9) without a very good reason, the callout_*
  interface is prefered.
 
 Can someone add a warning to the top of the makefile similar to the one for 
 spl?

It's not that bad, timeout(9) has a few cases, where replacing it involves
work. I've done that in DragonFly, I know what I'm talking about.

The reason for this advice is that the timeout(9) API has two major short
comings:
(a) It depends on some internal magic to provide the storage, but doesn't
have a clear way to handle errors. The storage space can be a few hundred
KB of kernel memory mostly wasted.
(b) It is difficult to cancel all outstanding timers correctly because
the race conditions are difficult to avoid when calling untimeout.

Since (b) is pretty much a requirement for the kernel nowaday and you
have to keep track of the return value anyway, you can almost mechanically
convert such code to the callout_* interface. That also avoids (a).

Concerning your original question about the inefficiency of DELAY, what
timeouts are we talking about? For anything in the area of a few micro seconds,
DELAY is most likely better, because it avoids context switches and
the associated cache pollution.

Joerg
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: MDELAY()

2005-04-12 Thread Brooks Davis
On Wed, Apr 13, 2005 at 02:33:22AM +0530, Dipjyoti Saikia wrote:
 Hi,
 
 Can any one help me out with a better Implementation of MDELAY() in
 FreeBSD kernel 4.10

Please start by defining better.

-- Brooks

-- 
Any statement of the form X is the one, true Y is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4


pgpyw5cCscSTf.pgp
Description: PGP signature