Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Oct 2011 18:54:57 +0200
From:      Riccardo Cattaneo <cattaneo.riccardo@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   4.4BSD timeslice management
Message-ID:  <127B21EE-2730-4463-8921-B79CCE2B5ECB@gmail.com>

next in thread | raw e-mail | index | archive | help
Hello,
I'm looking into the code of 4.4BSD scheduler (and related files) of =
FreeBSD version 7.2-RELEASE on an amd64 machine in order to understand =
how to manage time slices. I'm trying to dynamically change the length =
of the time slice on a thread by thread basis to "give more priority" or =
"less priority" to threads.
In function sched_clock (sched_4bsd.c) I found a piece of code in which =
thread's flags are added with TDF_NEEDRESCHED when the time slice =
(quantum) expires but I failed to notice any point in the code that =
actually preempt the thread.
Adding a per-thread parameter (e.g., in struct thread) I could set =
TDF_NEEDRESCHED when the dynamic time slice expires but how can I be =
sure the thread gets preempted? Where can I set a per-thread parameter =
(maybe after cpu_switch?!)? Is there a timer periodically calling a sort =
of context switch function or the context switches happen only when =
triggered by the kernel code?

Thanks
Riccardo Cattaneo=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?127B21EE-2730-4463-8921-B79CCE2B5ECB>