diff options
author | julian <julian@FreeBSD.org> | 2002-06-29 17:26:22 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-06-29 17:26:22 +0000 |
commit | aa2dc0a5d9e7a19420c153cd414fefa8498eab71 (patch) | |
tree | 0a0483a267784fa8e2bf86857d8727edb5b122e9 /sys/posix4 | |
parent | 6dbff7f2c1f8150887038aed666e11675adf0b4e (diff) | |
download | FreeBSD-src-aa2dc0a5d9e7a19420c153cd414fefa8498eab71.zip FreeBSD-src-aa2dc0a5d9e7a19420c153cd414fefa8498eab71.tar.gz |
Part 1 of KSE-III
The ability to schedule multiple threads per process
(one one cpu) by making ALL system calls optionally asynchronous.
to come: ia64 and power-pc patches, patches for gdb, test program (in tools)
Reviewed by: Almost everyone who counts
(at various times, peter, jhb, matt, alfred, mini, bernd,
and a cast of thousands)
NOTE: this is still Beta code, and contains lots of debugging stuff.
expect slight instability in signals..
Diffstat (limited to 'sys/posix4')
-rw-r--r-- | sys/posix4/ksched.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/posix4/ksched.c b/sys/posix4/ksched.c index c9081c3..bbe36be 100644 --- a/sys/posix4/ksched.c +++ b/sys/posix4/ksched.c @@ -181,7 +181,18 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched, mtx_lock_spin(&sched_lock); rtp_to_pri(&rtp, kg); - td->td_last_kse->ke_flags |= KEF_NEEDRESCHED; /* XXXKSE */ + FOREACH_THREAD_IN_GROUP(kg, td) { /* XXXKSE */ + if (td->td_state == TDS_RUNNING) { + td->td_kse->ke_flags |= KEF_NEEDRESCHED; + } else if (td->td_state == TDS_RUNQ) { + if (td->td_priority > kg->kg_user_pri) { + remrunqueue(td); + td->td_priority = + kg->kg_user_pri; + setrunqueue(td); + } + } + } mtx_unlock_spin(&sched_lock); } else @@ -203,7 +214,19 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched, * on the scheduling code: You must leave the * scheduling info alone. */ - td->td_last_kse->ke_flags |= KEF_NEEDRESCHED; /* XXXKSE */ + FOREACH_THREAD_IN_GROUP(kg, td) { + if (td->td_state == TDS_RUNNING) { + td->td_kse->ke_flags |= KEF_NEEDRESCHED; + } else if (td->td_state == TDS_RUNQ) { + if (td->td_priority > kg->kg_user_pri) { + remrunqueue(td); + td->td_priority = + kg->kg_user_pri; + setrunqueue(td); + } + } + + } mtx_unlock_spin(&sched_lock); } break; |