[Prev][Next][Index][Thread]

Re: Just passed my mind....




-----BEGIN PGP SIGNED MESSAGE-----

On Mon, 01 Mar 1999 12:47:53 -0500, in message <199903011747.KAA16809@golden.lbs.intnet.net>,
Leigh Stoller <stoller@fast.cs.utah.edu> (== stoller)
praised Shub-Internet thus:

> The threads package included with the OSKit is a mostly POSIX
> compliant thread implementation. I suggest you pick up the POSIX
> 1003.1 documentation for a thorough treatment of that.

I've been looking at this myself, to get the scheduler of my own
kernel up and running. However, in itself, it wouldn't integrate all
that well into the rest of the system (I'm looking at wildly non-POSIX
surroundings, at least), so it's more code reuse than anything
else. So I've been looking at:

> features of the x86 processor (TSS). Since there is no process model
> in the base environment, and obviously no per-process context, it is
> more efficient to hand-roll a simple context routine that handles
> switching the registers plus a few other odds and ends. If you are
> interested in actual details, then please take a look at the file
> threads/x86/switch.S.

this file. But, not knowing assembler, I do have the odd question, if
you'd indulge me (not knowing assembler):

thread_switch_realmode - I presume this is the routine you call to do
the actual task-switching?

Looking at it - that routine's passed a pointer to the thread
structure for the next thread to run - presumably I'd need to adjust
offsets, or is that what the THREAD_PPCB constant's for?, a spinlock
on the current thread's thread structure, and a pointer to the current
thread's thread structure?

Apart from (obviously) having properly initialised thread structures,
making sure I'm not trying to switch to the same thread I'm coming
from, and locking the thread structure of the one I'm switching to -
have I missed anything I need to do to make sure that using this
switch routine will work?

I'm not entirely certain of the purpose of the locks on individual
thread structures?

If I'm reading this correctly, this routine switches the processor
general-purpose registers and floating-point state - I gather it
doesn't do anything to the paging register? So if I'm wanting to
switch address spaces around, I'll need to watch for that myself and
do it elsewhere earlier in the scheduler? Is there anything else I'll
need to watch for if I'm switching user-mode threads as well as kernel
ones?

At the moment, I'm looking at doing a reschedule in three places -
from the timer interrupt, just before returning from a system call (in
a similar way to Linux), and from the handlers of some traps from
user-mode (I'm implementing exception-handling by suspending the
current thread, then passing an exception description to another
[dedicated] thread of the same process to handle) - can I reasonably
safely call it to do the switch from all of these?

Sorry about all the questions, but I *am* somewhat of a beginner to
kernel bashing... :)

Many thanks in advance,

Alistair

- -- 
Computational Thaumaturge, Deus Machinarum. -- Cerebrate of the Silicon Swarm.
e-mail: avatar-sig@arkane.demon.co.uk      WWW: http://www.arkane.demon.co.uk/

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: latin1
Comment: Processed by Mailcrypt 3.5.1, an Emacs/PGP interface

iQCVAgUBNtr6DjxrXHNqerOZAQGVZAP/eRX3OpPIlXgeA4mhvb3Qx7z/C0CDRTPi
w5xH7FfnGc756tSn45OLynbGzKbXerOFUcdpTrCgxt94Q7zhRjBPgquUfDmLao4p
8Hxub6gtZ/C3V79MgZdiMtKqUBDm4BA/kByjbGAj4BN55IItteIImtb2YNIW4Lwd
ddCmCnzv4hQ=
=qfzB
-----END PGP SIGNATURE-----
=================================
To subscribe or unsubscribe, send mail with "subscribe" or "unsubscribe"
to oskit-users-request@flux.cs.utah.edu.  The oskit-announce list is low
volume - if you want to subscribe, mail oskit-announce-request@flux.cs.utah.edu


References: