Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2002 17:35:25 -0700 (PDT)
From:      David Xu <bsddiy@yahoo.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        FreeBSD current users <current@freebsd.org>
Subject:   Re: Seeking OK to commit KSE MIII
Message-ID:  <20020604003525.69440.qmail@web20910.mail.yahoo.com>
In-Reply-To: <Pine.BSF.4.21.0206031046380.43219-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Thank you very much.

After I sent previous question to you, I was still thinking the mail.
and last night when I went to bed, I suddenly found that I was wrong,
choosethread() selects a highest priority thread from queue, if it is 
the lastest assigned thread, there is of course no more thread assigned 
KSE, because both runq and ksegrp's runq queue are always ordered,
this is an implicit logic by algorithm, I just forgot to consider that 
choosethread() select highest priority thread. sigh :(

--
David

--- Julian Elischer <julian@elischer.org> wrote:
> Thanks for looking at it....
> 
> This is not offtopic.. 
> 
> the answer is:
> No, the code is correct..
> 
> here is the logic..
> 
> If there are N processors, then there are at most N KSEs (kernel
> schedulable entities) working to process threads that belong to this
> KSEGOUP. (kg). If there are N or more threads runnable, the top N threads
> (by priority) are 'preassigned' to the N KSEs. The KSEs take their
> priority from those threads and are put on the run queue.
> 
> The last thread that had a priority high enough to have a KSE associated
> with it, AND IS ON THE RUN QUEUE is pointed to by
> kg->kg_last_assigned. Therefore when a KSE is
> removed from the run queue to become runnable, if it is the last assigned,
> that pointer must be removed from it. 
> Since it was removed, we know that it was teh highest priority KSE
> available, and since it was teh last assigned, we know there were no more
> KSEs available, and since we are not FREEING our KSE but using it, we know
> there are STILL no more KSEs available, we can prove that the next thread
> in the ksegrp list will not have a KSE to assign to it, so we can show
> that the pointer must be made 'invalid' because there aer now NO threads
> on the list that are assigned a KSE.
> 
> The pointer exists so that when a new threasd is maid runnable, it can
> have it's priority compared with the last assigned thread to see if
> it should 'steal' it's KSE or not.. i.e. is it 'earlier'
> on the list than that thread or later.. If it's earlier, then th e KSE is
> removed from the last assigned (which is now not assigned a KSE)
> and reassigned to the new thread, which is placed earlier inthe list.
> The pointer is then backed up to teh previous thread (which may or may not
> be the new thread.
> 
> I will try add more comments to explain what we are doing..
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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?20020604003525.69440.qmail>