Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×

Comment Re:Modula-3 FTW! (Score 1) 492

For example, you can compare the readability of Arabic numbers vs Roman numerals by asking two people proficient in each to perform the same arithmetic calculations, and you time them.

That would measure how easy it is to perform arithmetic in the two systems... which is not the same as readability. Similarly it's a good idea not to confuse "easy for a computer to read (and execute)" vs "easy for a human to read (and understand)" - both are important in different ways, but they are entirely separate concerns!

Comment Re: a better question (Score 1) 592

Perhaps you should once google what QMX actually is, so you relize it has nothing to do with 'process control'.

QNX, not QMX. It's a hard-realtime microkernel OS. That doesn't mean it can do process control on its own, but the realtime features are handy if that is what you want to do with it.

Comment Re:Programs people want to use... (Score 1) 449

Why haven't you written such a thing before? Because it's too much hassle. Which is the very reason threading is underused.

LOL. Actually there's a better reason such a thread launch facility doesn't commonly get written - which is that, in most circumstances, it really doesn't help performance that much, if at all - and the added complexity makes for a big net minus. There are a number of issues:

Firstly, spawning threads is expensive. Yes, on Linux it's "cheap", but that's "cheap" compared to other implementations - it's still a lot compared to doing a modest amount of work on the local CPU. (Why is it so expensive? Basically because there's a lot of housekeeping to do. In addition to the kernel creating new kernel structures for the new thread of execution (similar to creating a process), the process's thread library must allocate a stack for the new thread (involving modifying the process's page tables), iterate through all loaded shared libraries in order to allocate any thread-local storage they require, and so on, requiring multiple syscalls, a TLB flush, at least one context switch, and so on. To some extent the impact of this overhead can be reduced by maintaining a pool of ready-created threads, but this either takes away control of performance (if done automatically by your language/library) or substantially increases complexity (if you implement it yourself, since you then have to synchronise the threads carefully).

The second problem is that, unless you're very careful, extra threads don't buy you much performance, and can indeed hurt. Take the example you gave - doing some processing on each struct in an array, where each such struct contains an int and a double (16 bytes total, including alignment padding). With 64-byte cache lines (typical on x86), there are 4 such structs per cache line. If you distribute the processing over threads running on different cores, then instead of one core waiting for the cache line to come in to main memory, and then processing the 4 structs very rapidly (since they're now all in cache), you'll have 4 cores each waiting for the data to be available - i.e. up to a 4x slowdown for memory-bound tasks. And that's assuming the structure is only read from; if it's written to as well then the cache line will have to bounce between cores, and the multithreading slowdown will be many times worse. Now, if you ensure that structs in the same cache line get processed by the same core (ideally in sequence, and by the same kernel thread), then you do potentially get a big speedup - provided you don't hit any other gotchas - but the C++ code you're promoting doesn't seem to guarantee this in any way.

Third, and perhaps most importantly, data dependencies matter. In your example you're detaching all the threads; this is not realistic, because that means you cannot ever depend on their operations having finished. In the vast majority of cases you do need to know when an operation has finished: you're generally doing work for a reason - i.e. that you're going to use the result - and you can't begin to use that result until you know it has been produced. That, in of itself, adds complexity: you have to analyse your program's dataflow much more carefully in the presence of threads, because C/C++ will quite happily let you use a variable before another thread has finished assigning to it, without any sort of warning or exception. The analysis can certainly be done, and synchronisation put in place to eliminate the problems - but that is further overhead, both in the program's performance but also in the complexity of the program itself, and hence the time taken to write it (and especially to enhance it later, when the synchronisation model may not be so fresh in one's mind).

Used correctly and in the right circumstances, threads on an N-core system can give a N-times speedup (or greater, due to caching effects). Used badly, at best they'll reduce performance, and usually they'll increase complexity and lead to subtle bugs that are hard to debug.

The new thread features in modern C++ are very cool, but the fact they didn't exist before is not what's been preventing competent programmers from using threads all over the place :)

Comment Re:Contracts (Score 4, Interesting) 307

Retail or not, contracts are binding.

Contracts tend to be binding even when both parties don't read--most contracts are not read but are binding

Are you sure about that? Note the following (from the American Law Institute):

Where the other party has reason to believe that the party manifesting such assent would not do so if he knew that the writing contained a particular term, the term is not part of the agreement.

i.e. if you put terms into a contract that you know your customers aren't likely to agree to, then they're not binding, even if the contract is signed.

Comment Re:Not this shit again (Score 1) 834

None of it, expect of course that the University of Utah confirmed it, and a lot of people there have received this message. Read it for a fine example of crazy reactionary misogyny.

University of Utah confirmed that threat was completely un-credible and there was no credible threat to the students or anyone else. Once again you are so woefully uninformed about the most basic of facts that I wonder if you even so much as googled any of this before posting.

I couldn't find a source to back that up; instead, googling showed that the University of Utah prepared to enhance their security as a direct result of the threat. Or did I miss something? It's admittedly quite hard to search for without the results getting swamped with gamergate coverage of one sort or another...

Comment Re:You REALLY want to go down that road? (Score 1) 834

I lost count at 30 people doxxed by those that claim to stand for "feminism" and against gamergate, starting with the black developer who lost his job to racists harassing his boss and going downhill from there to people's bank accounts getting hacked, their utilities turned off, their income held up by fraud, a couple attempts at SWATting, and even syringes, knives, and dead animals in the mail.

I've missed all this... do you have any links?

Comment Re:Additional... both sides are showing bad behavi (Score 1) 834

Many of the journalists and supporters of the anti GG side have doxxed people... with their main accounts in the clear. Not sock puppet accounts that could be anyone. But they did it directly.

I haven't seen any of this; do you perhaps have a link?

I don't know why people keep bringing up harassment like this helps the anti GG side because the anti GG side has harassed far more.

Who said "we should bring back bullying" was that GG or anti GG? Anti GG. Every single fucking time.

I did see that one (only once though); at least the idiot in question apologised...

So they have no moral high ground there and I just thought that should be made very fucking clear. To the contrary, it is they that should be apologizing and explaining their own behavior which has been far worse.

People prominent in GG have received death threats, have had people call their work and tell their employers they're pedophiles, have had things mailed to their homes like knives or syringes...

Do you have any links about these?

Comment Re:Not this shit again (Score 1) 834

Every attacker of gamergate has been violent, sending death threads, making up BLATANTLY fake images to make themselves look like victims, and very publicly attacking people on Twitter as well.

I've got to confess I haven't seen any of this. Do you have a link?

Comment Re:Take away for me (Score 4, Insightful) 217

the preference of certain personality types for functional, static and strongly typed languages.

Translation: because only very high-skill programmers attempt to use the very unpopular functional languages (like lisp and erlang) the resulting code is, on average, of better quality.

There is another possible interpretation: that programmers who are very concerned about quality - and hence are happy when their language gives them lots of information about potential mistakes - like using languages with features (such as a strong type system) designed to allow detection of certain types of mistake. That is, it's specific features of the languages, rather than the fact that the languages are "unpopular", that draws quality-focussed programmers to them.

Of course, that is just as much conjecture as any other interpretation :-)

Comment Re:Old saying (Score 1) 249

No: basic geometry dictates that, to find a position in three dimensions, you need three measurements of distance.

Yes! Why are you assuming there is no distance information? There is!

What I said was that there is no distance information in the message received from the satellite. Of course you can derive distance information, or else GPS wouldn't work at all :-)

and the time by that satellite's clock - but since you have nothing to compare it against, you have no idea how long that signal took to reach you, so you get no information about your position.

This is where you're falling down. Of course you have things to compare it to. For each satellite, you have consecutive signals giving you new coordinates and a new time reference. You can calculate the distance between those two points. Then you can calculate the change in the difference between the timestamp in the signal and its arrival time. This actually gives you very good distance information, although of course it isn't static. (It could not be.)

Right - but there are two problems with this. One is that, by taking measurements over time, you do indeed get more information - but you also introduce more unknowns, because now you have to take into account the fact that you are likely to be moving - so you can't tell what part of the difference in the satellite signal is due to the satellite's motion, and which is due to yours. The other is that, even if you're guaranteed to be stationary, for your different readings from the same satellite to be useful, the satellite has to have moved a substantial distance, or else the errors in measurement will be relatively large compared to the change in timestamp difference - so you can't do an accurate calculation of your position. (This is why receivers won't give you a position readout even if they have 4 satellites, if those 4 satellites are very close together in the sky.) In practice it takes of the order of hours for the satellite to move sufficiently (which then introduces other problems - the quartz-based clocks in typical GPS receivers are not sufficiently accurate over such long periods.)

You can also make comparisons between the satellites. That only gives you relative, rather than absolute, distances,

Yes - which is exactly what I said :-) But differences only give you N-1 measurements for N satellites.

Comment Re:Old saying (Score 1) 249

Yes, I know you can do that, I even mentioned it :) But the person I was repying to claimed "3 satellites are sufficient to find your basic location and elevation" (emphasis mine) - i.e. they were claiming you could find the distance from the centre of the Earth, without assuming it.

No. You are finding your distance from the satellites. Not from the center of the Earth.

Umm... if you're claiming you can find your elevation, then you can find your distance from the centre of the Earth. It's more or less the same thing :-). I agree you can use the measurements from the satellites though (i.e. you don't need to know any information about your elevation a priori).

But since the 3-D positions of the satellites are known to a fine degree of accuracy, that's all you need.

I agree that the position of each satellite is known, to high accuracy. That's not the issue - the issue is that, if you have a signal from one satellite, that doesn't tell you your distance from that satellite. The signal basically says "I am satellite 7, I am at (position), and the time by my clock is (time)", and that is all your receiver receives. Receiving that signal tells you nothing about your position (well, possibly you can tell which hemisphere you're in from the fact that the satellite is visible at all, but that doesn't narrow things down much!). You only start getting information about your position when you have signals from more than one satellite, because then you can compare the timestamps - the difference in the timestamps gives you information about the difference in the distance from you to the two satellites.

And yes, 3 points and 3 distances is all you need to find a point in 3D space. It actually defines 2 points, but as mentioned before one is out in space so it obviously doesn't count. The other one is on the surface of the Earth (or in a plane, or whatever).

I agree that 3 points and 3 distances is all you need. The trouble is that the signal from 3 satellites only gives you 2 distances (unless, as jfengel mentions, you happen to be carrying round an atomic clock with you - which is generally not practical!).

You still need to think about probability, because the elevation model only tells you where the ground is - not where you are in relation to it. That said, the asumption "you're probably very close to the surface" is often very good, at least for most people :-)

No. Again, the orbits (and therefore positions) of the GPS satellites are known very precisely. As long as you can receive the signals from them, you could be above the ground, or below the ground, or even at the center of the Earth (at least theoretically), and still get your position and "elevation", even though it may be negative. Probability is not a factor at all, though accuracy certainly is. There are errors that have to be accounted for.

I mention probability because, even in the absence of 3 distances to give you a full 3D fix, you can use the fact that, statistically speaking, most people spend most of their time very close to the Earth's surface, to give a good estimate for one of the distances (i.e. estimate "I'm probably at or near ground level"), which then generally gives a pretty good estimate of your horizontal position. This is why even a 2D GPS fix is very useful in practice. But even if you have a signal from 4+ satellites, probability still comes into play: you have to account for radio interference, atmospheric effects and multipath effects, inaccuracies in the receiver's clocks, rounding errors, etc. etc., each of which adds uncertainty to the measurements and calculations and hence to the ultimate position readout.

Slashdot Top Deals

Make sure your code does nothing gracefully.

Working...