Gentoo Archives: gentoo-dev

From: Brandon Low <lostlogic@g.o>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] real concurrent multithreading with posix threads (pthreads)
Date: Sat, 29 Jun 2002 13:05:13
Message-Id: 20020629130513.A6213@lostlogicx.com
1 Stupid no reply to mangling.
2
3 Well I'll have to go beat up my professor then... Thanks for information,
4 I had thought he was wrong, but discussed with him later and he convinced
5 me. (I love proving professors wrong).
6
7 --Brandon
8
9 On Sat, 06/29/02 at 19:53:32 -0400, Marko Mikulicic wrote:
10 > Brandon Low wrote:
11 > > Well, I just happen to be taking an operating systems class ATM and yes in
12 > > linux the normal behavior is that glibc handles thread scheduling, but all
13 > > the threads are scheduled within the parent process' time slice. If you
14 > > NEED to have threads that run on different processors, and are scheduled
15 > > at the kernel level, from what I have thus far learned it appears that
16 > > Solaris or WinNT/2k/XPpro are the places to be.
17 > >
18 > > Hope this information is helpful.
19 > >
20 >
21 > What?!?
22 >
23 > Linux can schedule kernel threads since 1.3.x
24 > please read http://linas.org/linux/threads-faq.html.
25 >
26 > I have a SMP machine with a nice CPU meter wich let me easly see
27 > when which CPU is used, and I assure you that running multiple threads
28 > in linux occupies multiple CPUs.
29 >
30 > The problem with linux thread scheduling is the opposite:
31 > commercial threading implementations do M:N threading. that is
32 > M kernel threads each scheduling N user threads. Why: because
33 > user-mode context-switchs are faster than kernel-mode, but
34 > user-mode threads cannot be distributed between processors, so
35 > commercial OS implement a mix of the two models to achieve best
36 > performances.
37 > Linux doesn't yet seriously implement M:N threading but work is being
38 > done (look at NGPT). Linux has a very fast kernel context switch, so
39 > that M:N threads are still not a major issue.
40 >
41 > The glibc (libpthread) thread implementation uses the clone
42 > system call (man clone), which permits to multiple kernel processes
43 > to share the memory space, file descriptors, signal handlers,...
44 >
45 >
46 > Marko