News for hackers. Stuff that matters.
Re:Why Carmakers Can’t Transition to Newer Chips by rectang on Saturday October 02, 2021 @11:55AM (#28729589)
From earlier discussions here (https://news.ycombinator.com/item?id=9643551 "10,000 global variables"), Toyota's conservative, arguably antiquated approach to software architecture wouldn't necessarily prove reliable as that software evolves.

Trying to assess whether thousands of global variables are still playing nice during a major rewrite to accommodate a new chip would be definitely be difficult and time consuming!

Not that a fast-and-loose approach is ideal, either.

Writing reliable software in the context of an organization is hard.

Re:Why Carmakers Can’t Transition to Newer Chips by finnh on Saturday October 02, 2021 @01:02PM (#28730156)
10K global variables sounds insane, until i realize "oh, huh, we have that too, we just call it _config_".

Almost every place we would have a constant (tuning parameters, etc) we instead have a configurable value with the likely default declared in code, but all overridable in config. Managing config can be a hassle, but the number of times we've merely had to tweak a value rather than roll a new build pays for itself every day.

We have thousands of such "global variables"... of course they are read-only, so aren't used to share state.

If Toyota is doing that: nbd. If they are using them to share state ... god have mercy on their souls.

Re:Why Carmakers Can’t Transition to Newer Chips by tremon on Saturday October 02, 2021 @01:26PM (#28730323)
I always interpreted the "10K global variables" to mean 10K directly accessible, heap-allocated symbols. It's a code reek. If you use a configuration object or other abstraction, the number of accessible variables may not change, but their scope and access method does.

It's a matter of interpretation I guess, but I would not classify a wrapper object (like .Net's ConfigurationManager singleton) as "10K global variables" even if the accompanying config contained 10K items, or if the ConfigurationManager backing store was preallocated in the data section of the binary.

Re:Why Carmakers Can’t Transition to Newer Chips by delfinom on Saturday October 02, 2021 @01:38PM (#28730401)
>I always interpreted the "10K global variables" to mean 10K directly accessible, heap-allocated symbols. It's a code reek.

Which to me on an old _accelerator_ design is suspect because that's alot of heap for the micros that would have been used back in the day. This isn't a Linux system. It was at best a micro with like 8KB of RAM. (I'm not actually sure what it is but there's no way it was impressive).

Re:Why Carmakers Can’t Transition to Newer Chips by rectang on Saturday October 02, 2021 @07:23PM (#28733058)
From the article referenced in that earliser discussion: https://www.safetyresearch.net/toyota-unintended-acceleratio...

> Other egregious deviations from standard practice were the number of global variables in the system. (A variable is a location in memory that has a number in it. A global variable is any piece of software anywhere in the system can get to that number and read it or write it.)

However, that was from the article author explaining the testimony, and not the testimony itself. It's not totally clear whether the variables were writable.

I would have guessed they were statically allocated rather than heap allocated, but what really matters is whether they were `const` — and they probably weren't `const` because otherwise this testimony wouldn't have rung true:

> "And in practice, five, ten, okay, fine. 10,000, no, we’re done. It is not safe, and I don’t need to see all 10,000 global variables to know that that is a problem," Koopman testified.

Re:Why Carmakers Can’t Transition to Newer Chips by rightbyte on Saturday October 02, 2021 @01:51PM (#28730521)
If they used Simulink, the model output and input, aswell as state, are global variables when generated to C in some settings.