From: G. David Butler gdb@dbSystems.com
Subject: calling sleep() while holding lock()
Date: Fri, 9 May 1997 02:22:24 -0500 [thread overview]
Message-ID: <19970509072224.PUND5nigJDT0sGs8juwX2pyxy1_ZSTeb1HVQo535rp4@z> (raw)
Thanks for the input!
After having the stuff scared out of me with the mail from ncube, I
started to see just how bad it was. I have not finished by any means,
but I now have a system not sleeping on spin locks!
A summary of the changes:
port/devbit.c
move the smalloc outside the lock adding a free if necessary.
port/fault.c
change the smalloc to a malloc with a panic if it fails.
smalloc is the "sleeping" malloc. malloc does not sleep,
it returns 0 if there is no memory.
port/proc.c
added a zero assignment to hasspin on newproc()
added a panic if hasspin is set for the process sleeping.
added a panic if hasspin is set for the process in sched.
port/taslock.c
changed flagging hasspin to increment and decrement.
port/segment.c
added a missing unlock (found by adding a "stack" to lock and
unlock that is not included.)
pc/clock.c (All my machines are PCs)
removed the zero of hasspin.
The boddles follow relative to /sys/src/9 with the original files
called file_name.cdrom (e.g. port/fault.c.cdrom)
To make sure you get the whole thing, the last line says ThEeNd.
Remove it before you send it to rc -X.
Let me know how it goes.
BTW: THIS is the future of Plan9. What ever we make of it.
David Butler
gdb@dbSystems.com
#!/bin/rc
#
# command: /bin/boddle pc/clock.c.cdrom pc/clock.c
# srcdir: pc
# version: 863162201
# date: Fri May 9 02:16:41 CDT 1997
#
myname=$0
doextract=no
fn usage{
echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
exit usage
}
fn sigint{
rm -rf 863162201
exit interrupt
}
while(~ $1 -*){
switch($1){
case -X
doextract=yes
case -*
usage
}
shift
}
switch($#*){
case 0
srcdir=pc
case 1
srcdir=$1
case *
usage
}
if(! ~ $doextract yes){
echo This shell file contains a bundle of diffs representing changes
echo to original source files in the Plan 9 distribution. It will run
echo against the files in
echo ' ' $srcdir
echo '(unless overridden by the optional source directory argument)'
echo and create a directory 863162201 containing the updated files.
echo It will NOT automatically update the original files.
echo
echo Invoke with argument -X to perform the actual extraction.
exit 0
}
rm -rf 863162201
mkdir 863162201
target=863162201/clock.c.cdrom
echo -n '863162201/clock.c.cdrom: '
if(! test -f $srcdir/clock.c.cdrom || ! test -r $srcdir/clock.c.cdrom){
echo $srcdir/clock.c.cdrom unreadable
exit unreadable
}
sum=`{sum < $srcdir/clock.c.cdrom}
if(! ~ a11baa684391 $sum(1)^$sum(2)){
echo $srcdir/clock.c.cdrom is not the original distribution file
exit original
}
cp $srcdir/clock.c.cdrom 863162201/clock.c.cdrom
ed 863162201/clock.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM clock.c.cdrom'
66,70c
if(p->hasspin == 0 && anyready()){
sched();
next reply other threads:[~1997-05-09 7:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-09 7:22 G.David [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-05-09 16:16 Paul
1997-05-09 13:41 G.David
1997-05-09 8:00 Lucio
1997-05-08 18:32 beto
1997-05-08 16:53 David
1997-05-08 14:04 G.David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19970509072224.PUND5nigJDT0sGs8juwX2pyxy1_ZSTeb1HVQo535rp4@z \
--to=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).