Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!uwvax!cottage!lm From: lm@cottage.WISC.EDU (Larry McVoy) Newsgroups: comp.unix.wizards Subject: Re: light weight processes and threads Message-ID: <3872@spool.WISC.EDU> Date: Mon, 13-Jul-87 16:16:35 EDT Article-I.D.: spool.3872 Posted: Mon Jul 13 16:16:35 1987 Date-Received: Tue, 14-Jul-87 06:38:32 EDT References: <8272@brl-adm.ARPA> Sender: news@spool.WISC.EDU Reply-To: lm@cottage.WISC.EDU (Larry McVoy) Organization: U of Wisconsin CS Dept Lines: 38 In article <8272@brl-adm.ARPA> jfjr@mitre-bedford.arpa writes: > > I have been seeing "threads" and "light weight processes" in a Unix >context but I am not quite clear exactly what these terms mean in this >context and how such things are done. I thirst for enlightenment Listen, oh, Grasshopper, and ye shall learn. A process carries with it a certain amount of baggage. Under UNIX, this baggage is relatively small but still not negligible. The baggage is stuff that the OS needs to reference when performing services on behalf of the object. A context switch is (as you probably know) when one process is stopped and another process is started. Part (a substantial part) of the work is moving the old process's baggage out and the new process's baggage in. This is pure overhead, it does no work so far as the user is concerned. Consequently, we would like to minimize the amount of time spent doing context switches. One thing you can do is to make the period between switches very long. Unix does this to a certain extent - the timeout period is usually about a second. This makes interactive response suffer but more "work" is done. Another thing you can do is to have light weight processes. The idea is this: run more than one process within a single process's address space. Switching between these processes is little more (a white lie) than saving the old registers and throwing in the new ones. All the other baggage is unchanged, resulting in a faster context switch. There are a lot of good reasons to do this. MACH, a UNIX replacement, is trying to split up the kernel into multiple light weight processes. They have papers that spend a fair bit of effort explaining the concept. Hope this helps, Grasshopper. Larry McVoy lm@cottage.wisc.edu or uwvax!mcvoy