From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,2aedba6752dd2388 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-10-12 12:36:52 PST Newsgroups: comp.unix.osf.misc Path: gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.ans.net!newsgate.watson.ibm.com!yktnews.watson.ibm.com!hawnews.watson.ibm.com!news From: zac@tractor.austin.ibm.com Subject: Re: Threads better than forks? Sender: news@hawnews.watson.ibm.com (NNTP News Poster) Message-ID: Date: Tue, 12 Oct 1993 18:04:55 GMT Reply-To: zc@vnet.ibm.com Disclaimer: This posting represents the poster's views, not necessarily those of IBM. References: <1993Oct11.170510.13690@mnemosyne.cs.du.edu> <29ej1h$n33@hpuerca.atl.hp.com> Nntp-Posting-Host: zac.austin.ibm.com Organization: Not IBM X-Newsreader: IBM NewsReader/2 v1.00 In <29ej1h$n33@hpuerca.atl.hp.com>, sailer@atl.hp.com (Lee Sailer) writes: >Another difference between threads (tasks) and processes that I'm not quite >sure about has to do with scheduling. As I understand it, all a process's >tasks share that one process's timeslice. On the other hand, forked >process's each get a timeslice of their own. > > If this is true, than a function devided into 5 processes might execute >faster than the same function divided into 5 threads within one process, >since the 5 process solution would get five times the cpu time. > > lee This is true only for user-level threads. User-level thread libraries are cooperatively multitasked within a process' time-slice - the kernel doesn't know anything about them. A process only has a single thread of execution to work with. With kernel-level threads OTOH, the thread is the unit of scheduling. In other words the scheduler doesn't even deal with processes but just with threads. In this case a process starting 5 threads would get the same average cpu time as 5 single-threaded processes (assuming all the other variables like priority and i/o are kept equal). Zac I don't speak for IBM. Heck, I don't even WORK for IBM.