Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
Check out the new SourceForge HTML5 internet speed test! No Flash necessary and runs on all devices. ×

Comment Re:Maybe we should mimic civil engineering (Score 4, Insightful) 280

Civil engineers design with a safety margin such that their building's don't fall down. I work with a bunch of them. Civil engineers dread the thought that their building falls down.

What does this mean in terms of software? Software crashes all the time.

Software systems tend to have really complex side effects. Suppose I design a blood pressure monitoring machine for a hospital. It and a hundred other devices let the hospital run much more efficiently. The hospital only needs 1/2 the number of nurses. Now, someone discovers a bug in security camera, penetrates the network, discovers hundreds of Windows XP Embedded devices, and turns the hospital into a malware farm. (Incidents like this have happened.)

The hospital is screwed. It can't suddenly double the number of nurses, and even if you did, the nurses are used to the automated equipment. They don't know how to fall back to the non-networked way of doing things instantly. They are out of practice.

How could an engineer sign off on a system like this?

On one hand, it is running standard and recommended software (like Windows). Software has went through the FDA approval process. However, on the flip side, the hospital is a sitting duck. These embedded devices are hopelessly insecure, and there is no way to secure them against modern network threats.

I don't think we have proper methods of describing and solving modern safety issues in embedded systems. We have no proper method of understanding safety with machines built in one country, running software written two different countries, and then running somewhere else. The safety interactions even in a relatively stand-alone machine can be very tough to understand. These network enabled threats make things really hard.

Comment Re:Opinions are worthless (Score 1) 198

It appears that if you want people to do something useful in an unusual situation, then they need to practice. People get things really wrong in unusual situations. Automated systems screw up in unusual systems too. Airplane investigations are littered with examples of automation "helping" pilots and causing disasters. There are examples of pilots relying on automation, which didn't work and caused a disaster. There are examples of pilots getting confused, ignoring training and automation, and crashing functioning planes.

I think the only common thread is that if you want people to do something useful in an emergency situation, they need training and practice.

Comment Re:Buffers (Score 1) 497

The user may be doing a save operation because the computer is running out of memory. This means a deep-copy may fail during the save operation. If the computer is simply out-of-memory, then the user will be left without a copy of the most recent document. If you are up against a soft-memory limit (the system is paging to disk madly), then the program will appear to stop while the deep-copy takes place. This can be a long-time. Long enough for the user to give up, end-task the application, and then lose his work.

If the data structure is trivial, then it is safe to make the assumption the computer has lots of memory. However, in this case, the save operation will likely be quick so little advantage is gained from multi-threading. If the data structure is huge, then doubling the memory requirements during saves has significant performance advantages. But it is a no-win situation. The huge-data structure situation is also when the user would benefit from the multi-threading.

Improvements over a Multi-Threaded Deep Copy Save

A better solution than doing a deep copy is to duplicate only the bits of the data structure being modified by the user. Options:
a) Under Unix/Linux, do a fork(). If the fork fails, then serially output the file. If the fork succeeds, then a different process was created with a complete copy of the data structure. Save the file in the second process, and then use any IPC mechanism to communicate success or failure back to the parent process. This is a no-cost solution, because the VM subsystem keeps track of all the duplicate and dirty pages for you.
b) Under Windows. Design a thread-safe main data structure. This is hell. Even in Java, it is hell.

Building thread safe main data structures is hard
1. Performance is lost on every data structure access because the software has to check for the thread lock. This overhead can be worse than not having the data structure at all.
2. With modern processors do delayed writes to main memory, and the delays can reach hundreds of clock-cycles. Suppose a thread-locks are placed around a non-thread safe library/data structure on a large program. How do you protect against a Write after Write bug on a multi-core CPU?

Java's thread-locks may protect your code, but you have no idea what is happening in any non-thread safe third-party libraries. At least in C and C++, the debugger will often debug into those libraries and let you know the errors in your ways. In C# with third-party ActiveX controls, or in Java with low-level libraries, you are screwed.

I'm not saying a multi-threaded save can't work. It is a beautiful thing when done right. It is just a hard thing to do. It works best when the data structures are small, simple, tight and easy to understand.

Comment Re:arrogance is tops (Score 3, Interesting) 497

A related problem is that there is no way for the hiring manager to tell the difference between a very good programmer and a good programmer. All of the first year CS resumes say the candidates are skilled in C, Java, and a few more buzzwords. Every software project has a life-cycle, and the better programmers move between projects. This means all the experienced resumes show people with many projects. This makes it hard to tell the difference between a competent person that makes meaningful contributions then moves on, and a less competent person that is a good talker and drifts.

It's a real problem for the hiring manager. It essentially means that you can't pay more for better programmers. Economists even have terms for this. Product differentiation. If you can't show you are an A+ programmer as opposed to an A programmer or a C programmer, then it becomes difficult to make the case that the A+ programmer is worth four C programmers. It even becomes difficult to tell who the A+ programmers are. This tends to drive out experienced programmers into other careers.

This problem really affects software engineers. I can tell the difference between a skilled electrician and an unskilled electrician in minutes. Great architects win awards. Develop a great piece of real-time engineering on a safety-critical system - no one is ever going to see your work. Sure, you might save lots of lives with your code. But the hiring manager for your next job can't tell the difference.

Comment Re:Buffers (Score 3, Interesting) 497

Microsoft wrote a bunch of code, that in hindsight was a really really bad idea. I'm not really sure that the problems were all Microsoft's fault - they probably didn't invent them. They are Microsoft's fault in that they embedded the concepts into the operating system and then widely popularized them.

The big gotchas all have to do with limitations of C, and the twists used to optimize Microsoft's programming for the 8086 architecture. I'm thinking of:

char string[MAX_PATH];
What can possibly go wrong? Especially before MAX_PATH was invented.

malloc() new() and friends
For any non-trivial program, it's almost impossible to get correct. They only really work for something like a C compiler which will allocate a variable amount of memory, do a task, and then end. If you miss a few free() calls along the way - they will be cleaned up when the compiler terminates.

GlobalAlloc(), LocalAlloc() and friends
Just in case you couldn't make it work with malloc, try the operating system version of the call. Using OS calls really opened the window to some famous bugs - OpenSSH comes to mind.

Multi-threading in C
For any non-trivial problem - it doesn't work. Firstly, for any non-simple piece of code, it is tough to do correctly. Secondly, for a trivial piece of code, like a save operation, you need to somehow make the memory being stored immutable for the duration of the save. For most save operations, this defeats the purpose, as the first thing the user wants to do after save is to change the document. Thirdly, if you really need multi-threading, there is a good chance some of your users need parallel-processing across machines. Multi-threaded code and parallel-processing code are not the same things at all.

Embedding code in data.
Firstly, the x86 architecture encouraged this, by not having proper page protections. Secondly, it completely opens the system up to malicious code. ActiveX, JPEG libraries, font libraries, everywhere Microsoft had an API that embedded code in data, it was all exploited.

Comment Re:Windows CE - hmmmm (Score 1) 292

GM did you a favor. I have a Kia with the Microsoft system. An Apple iPhone can crash the system so hard that it needs a full reboot. You have to stop the car, turn the engine-off and restart to get the phone interface working again. The system doesn't work with Android properly either. I assume Microsoft's system must work well with a Zune or a Lumia phone, however I have never seen one to try it out. :-)

Keep the engine stuff separate than the entertainment stuff. If you let Microsoft near your car controls, then it will be like the old Bill Gates compares Windows to a GM car joke.

Comment Re:Pricey (Score 4, Informative) 205

Big difference: The RaspberryPi has TTL I/O. This makes it easy to do any of a wide variety of hardware interfacing. This new board only has UART ports, which means if you want to do an easy hardware project, you need another microcontroller, tool-chain, etc.

There is a definite market for prototype devices that talk Ethernet, WiFi, UART, SPI, I2C and hardware I/O too. The Raspberry Pi does that well, and inexpensively.

Comment WiFi across the food court (Score 1) 264

The FBI busted Russian sleeper agents using the WiFi across the food-court trick.

As such, I don't think the WiFi across the food-court would help the DNC.

See the story. There are many articles on the cell. Only a few mention the WiFi link. Quite a few debate whether the agents were actually sleeper agents.

Comment Re:Whiny Fanboy... but he has a point (Score 1) 260

The trailers are shot before the film is. If the trailers don't fit the film as shot, its tough to include them.

Now, if the film companies actually waited for the film to be finished before advertising it, then they wouldn't get caught advertising something they couldn't deliver.

Comment Re:Sweet (Score 1) 286

Try 3 at that demo program:

#include <stdio.h>
#include <vector>

#define bool 2
#define vector vector<int> test // Insert almost anything here, use trailing \ if necessary

int main() {

test[0][0] = 1;
test[1][0] = 2;
printf("%d %d\n", test[0][0], test[1][0]);


Comment Re:Sweet (Score 1) 286

The beauty of C++ is that std::vector[bool] can be almost anything. See below:

#include <stdio.h>
#include <vector>

#define bool 2
#define vector vector test // Insert almost anything here, use trailing \ if necessary

int main() {

test[0][0] = 1;
test[1][0] = 2;
printf("%d %d\n", test[0][0], test[1][0]);


I wish I didn't know enough of C++ to write the above ...

Slashdot Top Deals

Advertising is the rattling of a stick inside a swill bucket. -- George Orwell