Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2002 11:54:19 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        arch@freebsd.org
Cc:        dillon@freebsd.org
Subject:   STOP and SLEEP in the kernel 
Message-ID:  <Pine.BSF.4.21.0201221130030.18165-100000@InterJet.elischer.org>

next in thread | raw e-mail | index | archive | help

Matt Dillon and I spent some time looking at the way in which process
suspension is achieved in FreeBSD in order to try work out how best to do
it in the KSE kernel.

We discovered a couple of things. 
FIrstly that teh suspension occurs in CURSIG() which is an alias for
issignal()

and that CURSIG is called in a number of places, at least one of which
seems to us to be a rather dubious place to suspend a process.

for example:
in cv_switch_catch()
cv_wait_sig()
msleep()
userret() <-this is ok
ncp_poll()

It seems to us that we need to think carefully about whether suspending a
thread in cvwait or msleep is a good idea. ncp_poll() seems a really odd
place for a thread to suspend. The difficult part for me in a
multithreaded system another thread could call exit() while the thread is
stopped there and I need to be able to break it out safely. This means
that I need to be able to get it to back out to the user boundary at
least, so that I can be sure it's released all resources before I shoot
it.

Surely a thread can continue within the kernel
while the process is stopped as long as it's suspended before it tries to 
go back to userland.
I would suggest that we use a separate check for suspended state, rather
than combine it into CURSIG. It would allow a check for signals that would
be independent of the worry that the thread would freeze there.
PLUS there is in the KSE kernel, now the possibility that a process is
suspended in a way completely independent of signals.
(this was always the case to some extent as signals really needn't be used
for stopping a process for tracing reasons).

Signals and suspension are the last major hurdle before I can get a
multithreaded process running.



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0201221130030.18165-100000>