threads without kernel mods

der Mouse mouse at thunder.mcrcim.mcgill.edu
Sun May 26 23:56:20 AEST 1991


In article <1991May20.123423.10388 at linus.mitre.org>, jfjr at mbunix.mitre.org (Freedman) writes:

> I need to know about implementing threads or lightweight processes
> without modifying kernel - ie strictly user level implementations.

> How is this accomplished?  Some variant on setjmp/longjmp?

Machine-dependent, perhaps even operating-system-dependent.  I did it
once for 4.3 on a VAX, using SIGALRM to context-switch.  The
implementation depended on knowing some of the internal details of
signal delivery; if I had to do it again I think I'd go about it
differently.  (For one thing, my implementation had no way for a thread
to voluntarily give up the rest of its timeslice....)

Obviously, you will have the problem that any thread blocking in a
syscall blocks all other threads as well.  This may or may not actually
cause you headaches.

If you can build a context switcher, you're most of the way there.  In
fact, if you don't want to ever trigger a context switch from a signal,
that's about all you need.  Dealing with signals can be, errr, fun....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.unix.internals mailing list