ArticleslgStudy

science

The Power of 10: Rules for Developing Safety-Critical Code

The Power of 10: Rules for Developing Safety-Critical Code is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand The Power of 10: Rules for Developing Safety-Critical Code rather than just read about it. In short: The Power of 10 Rules were created in 2006 by Gerard J. Holzmann of the NASA/JPL Laboratory for Reliable Software.

Key takeaways

  • The Power of 10: Rules for Developing Safety-Critical Code belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect The Power of 10: Rules for Developing Safety-Critical Code to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of The Power of 10: Rules for Developing Safety-Critical Code from memory before moving on to harder problems.

Reference excerpt

The Power of 10 Rules were created in 2006 by Gerard J. Holzmann of the NASA/JPL Laboratory for Reliable Software. The rules are intended to eliminate certain C coding practices that make code difficult to review or statically analyze. These rules are a complement to the MISRA C guidelines and have been incorporated into the greater set of JPL coding standards.

Rules The ten rules are:

Restrict all code to very simple control flow constructs—do not use goto statements, setjmp or longjmp constructs, or direct or indirect recursion. Give all loops a fixed upper bound. It must be trivially possible for a checking tool to prove statically that the loop cannot exceed a preset upper bound on the number of iterations. If a tool cannot prove the loop bound statically, the rule is considered violated. Do not use dynamic memory allocation after initialization. No function should be longer than what can be printed on a single sheet of paper in a standard format with one line per statement and one line per declaration. Typically, this means no more than about 60 lines of code per function. The code's assertions density should average to minimally two assertions per function. Assertions must be used to check for anomalous conditions that should never happen in real-life executions. Assertions must be side-effect free and should be defined as Boolean tests. When an assertion fails, an explicit recovery action must be taken such as returning an error condition to the caller of the function that executes the failing assertion. Any assertion for which a static checking tool can prove that it can never fail or never hold violates this rule. Declare all data objects at the smallest possible level of scope. Each calling function must check the return value of nonvoid functions, and each called function must check the validity of all parameters provided by the caller. The use of the preprocessor must be limited to the inclusion of header files and simple macros definitions. Token pasting, variable argument lists (ellipses), and recursive macro calls are not allowed. All macros must expand into complete syntactic units. The use of conditional compilation directives must be kept to a minimum. The use of pointers must be restricted. Specifically, no more than one level of dereference should be used. Pointer dereference operations may not be hidden in macro definitions or inside typedef declarations. Function pointers are not permitted. All code must be compiled, from the first day of development, with all compiler warnings enabled at the most pedantic setting available. All code must compile without warnings. All code must also be checked daily with at least one, but preferably more than one, strong static source code analyzer and should pass all analyses with zero warnings.

Uses The NASA study of the Toyota electronic throttle control firmware found at least 243 violations of these rules.

See also Life critical system Coding conventions Software quality Software assurance

Further reading G.J. Holzmann (2006-06-19). "The Power of 10: Rules for Developing Safety-Critical Code". IEEE Computer. 39 (6): 95–99. doi:10.1109/MC.2006.212.

References

External links NASA Technical Standards System Software Assurance and Software Safety Standard Open Source Satellite: How do you make software that is reliable enough for space missions?

Worked examples

Example 1 — a first encounter with The Power of 10: Rules for Developing Safety-Critical Code

Start with the simplest possible case. Write down what The Power of 10: Rules for Developing Safety-Critical Code claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to The Power of 10: Rules for Developing Safety-Critical Code before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about The Power of 10: Rules for Developing Safety-Critical Code ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of The Power of 10: Rules for Developing Safety-Critical Code

In research
The Power of 10: Rules for Developing Safety-Critical Code appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses The Power of 10: Rules for Developing Safety-Critical Code in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
The Power of 10: Rules for Developing Safety-Critical Code is common in secondary-school and first-year university syllabi. It links to neighbouring topics C (programming language), Programming principles, so understanding it makes those chapters shorter.
In everyday life
Look for The Power of 10: Rules for Developing Safety-Critical Code outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “The Power of 10: Rules for Developing Safety-Critical Code” →

How to study The Power of 10: Rules for Developing Safety-Critical Code in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what The Power of 10: Rules for Developing Safety-Critical Code means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain The Power of 10: Rules for Developing Safety-Critical Code out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is The Power of 10: Rules for Developing Safety-Critical Code in simple terms?

The Power of 10 Rules were created in 2006 by Gerard J. Holzmann of the NASA/JPL Laboratory for Reliable Software.

Why does The Power of 10: Rules for Developing Safety-Critical Code matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study The Power of 10: Rules for Developing Safety-Critical Code?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on The Power of 10: Rules for Developing Safety-Critical Code.

Tags

  • C (programming language)
  • Programming principles

Keep exploring