summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-06-29 17:26:22 +0000
committerjulian <julian@FreeBSD.org>2002-06-29 17:26:22 +0000
commitaa2dc0a5d9e7a19420c153cd414fefa8498eab71 (patch)
tree0a0483a267784fa8e2bf86857d8727edb5b122e9 /sys/kern/init_main.c
parent6dbff7f2c1f8150887038aed666e11675adf0b4e (diff)
downloadFreeBSD-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/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index d5c5656..06cc8d8 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -289,6 +289,7 @@ proc0_init(void *dummy __unused)
* Initialize thread, process and pgrp structures.
*/
procinit();
+ threadinit();
/*
* Initialize sleep queue hash table
@@ -322,19 +323,34 @@ proc0_init(void *dummy __unused)
p->p_sysent = &aout_sysvec;
#endif
+ /*
+ * proc_linkup was already done in init_i386() or alphainit() etc.
+ * because the earlier code needed to follow td->td_proc. Otherwise
+ * I would have done it here.. maybe this means this should be
+ * done earlier too.
+ */
ke = &proc0.p_kse; /* XXXKSE */
kg = &proc0.p_ksegrp; /* XXXKSE */
p->p_flag = P_SYSTEM;
p->p_sflag = PS_INMEM;
- p->p_stat = SRUN;
- p->p_ksegrp.kg_nice = NZERO;
- kg->kg_pri_class = PRI_TIMESHARE;
- kg->kg_user_pri = PUSER;
- td->td_priority = PVM;
- td->td_base_pri = PUSER;
-
+ p->p_state = PRS_NORMAL;
+ td->td_state = TDS_RUNNING;
+ kg->kg_nice = NZERO;
+ kg->kg_pri_class = PRI_TIMESHARE;
+ kg->kg_user_pri = PUSER;
+ td->td_priority = PVM;
+ td->td_base_pri = PUSER;
+ td->td_kse = ke; /* XXXKSE */
+ ke->ke_oncpu = 0;
+ ke->ke_state = KES_RUNNING;
+ ke->ke_thread = td;
+ /* proc_linkup puts it in the idle queue, that's not what we want. */
+ TAILQ_REMOVE(&kg->kg_iq, ke, ke_kgrlist);
+ kg->kg_idle_kses--;
p->p_peers = 0;
p->p_leader = p;
+KASSERT((ke->ke_kgrlist.tqe_next != ke), ("linked to self!"));
+
bcopy("swapper", p->p_comm, sizeof ("swapper"));
@@ -662,8 +678,7 @@ kick_init(const void *udata __unused)
td = FIRST_THREAD_IN_PROC(initproc);
mtx_lock_spin(&sched_lock);
- initproc->p_stat = SRUN;
- setrunqueue(FIRST_THREAD_IN_PROC(initproc)); /* XXXKSE */
+ setrunqueue(td); /* XXXKSE */
mtx_unlock_spin(&sched_lock);
}
SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kick_init, NULL)
OpenPOWER on IntegriCloud