login
Header Space

 
 

netbsd-tech-kern mailing list

FromSubjectsort iconDate
Matt Thomas
IPLs - One too many?
I've been talking to Chris Gilbert for a while about eliminating nested interrupts in one or more of the ARM ports. Ignoring IPL_SOFT* IPLs for the moment, ARM currently has IPL_NONE < IPL_VM < IPL_SCHED < IPL_HIGH Since IPL_SCHED == IPL_CLOCK, once IPL_SCHED is reached you block clock interrupts. Since clock interrupts are the highest priority interrupts, you have basically blocked all interrupts. So there is little difference between IPL_HIGH and IPL_SCHED. So why have both? Ca...
Jul 24, 6:21 pm 2008
Christos Zoulas
Re: libc warnings/fix
In article <20080724074745.GI22423@shisha.spb.ru>, Why? The first two seem like compiler regressions and the compiler should be able to figure out. The third is more difficult for the compiler to figure out, so it is acceptable. christos
Jul 24, 4:24 pm 2008
David Laight
Re: libc warnings/fix
I guess the first is because the compiler has detected that 'get_shared' doesn't set '*rci' in all paths. Similarly for '*variable' in lookup_mapper_entry. David -- David Laight: david@l8s.co.uk
Jul 24, 4:41 pm 2008
Alexander Shishkin
libc warnings/fix
Hi, I have one more patch [1] to fix three "may be used uninitialized in this function" warnings emitted by newer gcc. All three are unlikely to cause any problems [obviously], but are perfectly valid from compiler's standpoint. [1]: http://koowaldah.org/people/ash/netbsd/fix-libc-warnings.patch Regards, -- Alex
Jul 24, 3:47 am 2008
Andrew Doran
Re: revivesa status 2008/07/09
As far as I can tell, this is the fictional application that M:N is targeted at: tens of thousands of threads running in userspace, doing nothing but synchronizing among themselves. In other words, an app that does nothing. 10 years ago that might have seemed new and cool, even necessary, but people have begun to get to grips with multithreaded programming and it's now obvious that thread synchronization is to be avoided at all costs. Even that fictional app will break down with more than one CPU,...
Jul 24, 4:25 am 2008
SODA Noriyuki
Re: revivesa status 2008/07/09
It's not right that the app does nothing. For example, please think about UNIX pipeline, the processes which construct the pipeline are doing work, but only two processes at the left edge and the right edge of the pipeline are doing real I/O, any other processes are just doing transformation of information and synchronization. The same thing can be done with threads instead of processes. And all we know this model makes programming far much easier For applications like UNIX network servers, that...
Jul 24, 8:51 am 2008
David Holland
Re: revivesa status 2008/07/09
Shouldn't on MP systems either :-) (not that I know if we do or not, I haven't looked inside libpthread Right now there aren't, overall, very many apps that are threaded such that the threading buys much in the way of performance. There also aren't, overall, very many apps that make 10,000 user threads, because it doesn't work, at least not without using Erlang or some other similar environment with its own threading code. Both of these things are likely to change over the next five to ten y...
Jul 23, 10:18 pm 2008
Jason Thorpe
Re: revivesa status 2008/07/09
That, I think, is implied -- an MP system needs to have the atomic operation primitives that locks are built upon, which is why I didn't mention it :-) The whole argument for SA seems to be "faster on UP Right, well, the idea all those years ago is that apps would create billions of threads. But if course it didn't really turn out that way. In my day job, I am responsible for an app that creates ~150 threads or so and pretty much everyone involved with it (including me) Eh, t...
Jul 24, 12:34 pm 2008
Johnny Billquist
Re: revivesa status 2008/07/09
Different area, I know, but working in Erlang, creating 150 threads don't even raise an eyebrow. So, as usual, it all depends on where you work, and with what. As for the rest of the discussion, I'm staying out of it. I've just come to the realization that NetBSD don't fit my hand that well anymore. Johnny
Jul 24, 1:06 pm 2008
SODA Noriyuki
Re: revivesa status 2008/07/09
>>>>> On Thu, 24 Jul 2008 02:18:56 +0000, That's just not right. See the graph attached at Message-ID: <18567.57418.474635.710749@srapc2586.sra.co.jp> NetBSD SA could run 7,000 threads on Celeron 400MHz with only 128MB RAM even 5 years ago. With today's RAM size, 70,000 threads or even 700,000 threads must be possible. -- soda
Jul 23, 10:44 pm 2008
Ted Lemon
Re: revivesa status 2008/07/09
Just because there aren't many apps that you know of doesn't mean there aren't any at all, nor that there is no potential for growth in this area. There are a lot of apps that use state threads, which is essentially a non-preemptive analog to scheduler activations. This is very useful for applications that have to handle a lot of small tasks that have to process work pipelines where each step in the pipeline involves a wait for some event to occur - either another thread to finish...
Jul 24, 12:15 am 2008
Jason Thorpe
Re: revivesa status 2008/07/09
The right model for that is to use a continuation. Threads by their nature have stacks and other resources that make them too heavyweight to be appropriate for this type of processing. -- thorpej
Jul 24, 12:37 pm 2008
Ted Lemon
Re: revivesa status 2008/07/09
No argument here. However, in practice there's no decent scheme compiler to use for this, so people wind up doing it in C with threads or state threads. In my experience, the cases where you need threads and not continuations are rare, and a lot of extra work is needed when doing threads that's completely unnecessary. Nevertheless, people persist in programming in C because there are good compilers, and continuations are... hard... in C. Anyway, the more I think about this th...
Jul 24, 4:20 pm 2008
Havard Eidnes
Re: revivesa status 2008/07/09
That's not the only serious problem such a change would introduce. As far as I understand it, such a change would *in practice* force a synchronized upgrade of both kernel and user-land (mostly due to "dragged-along dependencies"), as exemplified by a transition from 4.0 to -current, to preserve full functionality. This makes it cumbersome to say the least to back down of such an upgrade, if one were so inclined, something we've supported in the past by having the ABI contract between user-land ...
Jul 24, 6:31 am 2008
Jason Thorpe
Re: revivesa status 2008/07/09
It should only force kernel+libc+libpthread (and, really, libc +libpthread should probably be just in a single library). -- thorpej
Jul 24, 12:19 pm 2008
Havard Eidnes
Re: revivesa status 2008/07/09
That's the theory, and why I said *in practice* above. If I recall correctly, practice has shown that as things stand now, more libraries will need to be upgraded. Regards, - Håvard
Jul 24, 5:09 pm 2008
Antti Kantee
Re: revivesa status 2008/07/09
Unification seconded. And while in there, there should be no difference between "single-threaded without pthread" and "single-threaded with pthread" like there currently is.
Jul 24, 12:51 pm 2008
Jason Thorpe
Re: revivesa status 2008/07/09
Agreed. Because if you have an app that loads a plugin, you have no idea if it is going to use threads or not, even if your app is not multi-threaded. On UP systems, the locking primitives are light-weight enough that the overhead doesn't matter, and MP systems could possibly take short-cuts internally if no threads other than the main thread exist. -- thorpej
Jul 24, 1:28 pm 2008
Andrew Doran
Re: revivesa status 2008/07/09
I keep hearing this and in my experience it's not true. One test case I can think of is MySQL and the supersmack benchmark. It makes heavy use of thread synchronization and issues lots of trival queries. Whatever gains SA makes in the thread synch area are blown away by the overhead it imposes on kernel If context switch is slow on ARM then why not make it faster? The entire system would benefit, not just threading. A lot of time was invested in the I don't have such a platform, but I can provid...
Jul 24, 4:35 am 2008
Andrew Doran
Re: revivesa status 2008/07/09
No. In fact, it adds overhead to I/O bound workloads. Andrew
Jul 24, 4:26 am 2008
Mindaugas Rasiukevicius
Re: revivesa status 2008/07/09
Not only context switch, but it also needs a new LWP (kernel thread) when blocking. In a case of new pthread (userland) or cold "LWP-cache" (actually, it is pool) it means: creation of new LWP + context switch. Also, at some point LWP should be destroyed or put back to the "LWP-cache", what means more overhead, or well.. wasting of memory. Imagine a case of 1000 (new) pthreads which block - that would mean: 1000 * (LWP creation + SA context switch) operations. Plus, LWPs for VPs... -- Best re...
Jul 24, 6:07 am 2008
Bill Stouder-Studenmund
Re: revivesa status 2008/07/09
.. That would be the exact same LWP usage as a 1:1 threading model would=20 give. The SA process spends the time creating the LWPs between blocking=20 events while the 1:1 process created all of the same LWPs at initial=20 thread creation time. Yes, the SA process also has an extra LWP sitting around per VP, but that= =20 is a constant so it really only should count against process startup. One other thing to consider is how long different context switches take.=20 The two important ones are ...
Jul 24, 12:53 pm 2008
Mindaugas Rasiukevicius
Re: revivesa status 2008/07/09
Not exactly. To create LWP when blocking (that is, switching the context) SA invents a lot of complexity, and hacks (eg. locking against order). Also, But well.. what Andrew said - let's rather spend time optimising the context Bringing SA back invents more than 3000 lines of very complicated code. Why? - To support specific backwards compatibility which we never actually supported (see what Andrew and Jason wrote). - To support theoretical performance for some workload, where seems nobody...
Jul 24, 5:57 pm 2008
SODA Noriyuki
Re: revivesa status 2008/07/09
>>>>> On Wed, 23 Jul 2008 15:49:34 -0700, There are some sort of multi-thread programs that thread synchronization happens far more often than time-slicing or I/O blocking. e.g. Some simulations which give thread context to each object. The effect of time-slicing you said doesn't matter on such programs. The attached graph is a result such sort of benchmark which was measured on 2003 October when SA was merged (X-axis is number of threads, log-scale. Y-axis is time [microsecond]...
Jul 23, 9:49 pm 2008
SODA Noriyuki
Re: revivesa status 2008/07/09
Oops, forgot to attach the file.
Jul 23, 9:52 pm 2008
Jason Thorpe
Re: revivesa status 2008/07/09
I don't see a "netbsd-1:1" in that chart. -- thorpej
Jul 24, 12:25 pm 2008
SODA Noriyuki
Re: revivesa status 2008/07/09
>>>>> On Thu, 24 Jul 2008 09:25:09 -0700, Yes, of course, because it was measured 5 years ago. There wasn't netbsd-1:1 at that age. But I'm sure that netbsd-1:1 is slower than netbsd-SA, since all 1:1 implementations require kernel/userland context switch, while userland implementations and SA don't need it at all. There is no reason that netbsd-1:1 can be comparable with netbsd-SA in this particular benchmark. Probably netbsd-1:1 will be equal to redhat9-nptl at best, or perhap...
Jul 24, 1:39 pm 2008
Andrew Doran
Re: revivesa status 2008/07/09
Ignoring the mutex size issue, we are still compatible at the library level. If statically linked pthread applications do actually work in 4.0, then it's by accident. Even with dynamically linked binaries the initialization relies on a stack of obscure bugs to work. Andrew
Jul 24, 4:29 am 2008
Jason Thorpe
Re: revivesa status 2008/07/09
As far as I am aware, statically linked pthreads applications have never worked / been supported. We should drop any and all illusions of it working by NOT installing the .a file. I think the only platform we "support" that doesn't have dynamic linking is m68010 (sun2). -- thorpej
Jul 24, 12:24 pm 2008
previous daytodaynext day
July 23, 2008July 24, 2008July 25, 2008
speck-geostationary