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 :(


--- Julian Elischer <[EMAIL PROTECTED]> 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

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to