Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2001 15:32:46 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        Luigi Rizzo <rizzo@aciri.org>
Cc:        John Baldwin <jhb@FreeBSD.org>, current@FreeBSD.org
Subject:   Re: where is the idle_loop in current ? 
Message-ID:  <200111232332.fANNWkf02358@mass.dis.org>
In-Reply-To: Your message of "Fri, 23 Nov 2001 15:15:22 PST." <20011123151522.B58238@iguana.aciri.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> In order to port my network polling stuff to current, I was looking
> at ways to do things within the "idle loop", and was pointed to
> the idle_proc() or vm_pagezero() .  I am listing below the code
> for these kernel threads (I hope the name is the correct one).

You should just schedule a thread with priority equal to or just above 
that of the idle thread.

> I do not follow, however, the reason why these two threads periodically
> give up the CPU, given that their priority is (i guess) lower than
> any other thread in the system, so any event that should wake up
> a thread would immediately cause their preemption.
> Where am i wrong ?

Spinning forever in a thread is always a bad idea; you can't be assured 
that you will always be preempted.  The idle thread calls the scheduler 
periodically for just this reason; it's a safer design.

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111232332.fANNWkf02358>