Threading system calls (int 80h)
Ekkehard Morgenstern
ekkehard.morgenstern at onlinehome.de
Sat Oct 21 14:28:46 PDT 2006
On Friday 20 October 2006 23:24, John-Mark Gurney wrote:
> That's why you use rfork_thread(3)...
Thanks! That really helps! :-)
What I'm trying to do is to write a virtual machine in assembly language on
FreeBSD that can be run right after the kernel has been loaded. I would like
to avoid external library dependencies, so, for threading, I need some
mechanism to make it possible with kernel calls only.
I'll be looking at the THR calls as well, but it helps my confidence that
rfork(2) and rfork_thread(3) are documented.
I'm not sure if I understood the FreeBSD threading mechanism correctly. Are
threads always processes? Then it would make no difference if I fork instead
of using specific threading calls. I would like to enable the users of my VM
to take advantage of multiple CPUs, so a process-based solution doesn't look
so bad.
How much overhead is involved in FreeBSD multitasking?
I will probably also implement a virtual threading mechanism, because every VM
process or thread can also multiplex instruction streams scheduled to run
concurrently, at least as long as they're interpreted and not converted to
native code yet. When the number of virtual threads exceeds a configurable
limit, a real thread or process can be created that can run further virtual
threads.
Does anyone of you have any further recommendations or advice? I would like to
pick a solution that can perform optimally on FreeBSD.
- Ekkehard.
More information about the freebsd-hackers
mailing list