21.08.2013 Views

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

242 Chapter 17 ■ <strong>Software</strong> robustness<br />

17.3 ● Fault detection by hardware<br />

We have already seen how software checks can reveal faults. Hardware also can be vital<br />

in detecting consequences of such software errors as:<br />

■ division by zero, more generally arithmetic overflow<br />

■ an array subscript outside the range of the array<br />

■ a program which tries to access a region of memory that it is denied access to, e.g.<br />

the operating system.<br />

Of course hardware also detects hardware faults, which the hardware often passes on<br />

to the software <strong>for</strong> action. These include:<br />

■ memory parity checks<br />

■ device time-outs<br />

■ communication line faults.<br />

Memory protection systems<br />

One major technique <strong>for</strong> detecting faults in software is to use hardware protection mechanisms<br />

that separate one software component from another. (Protection mechanisms<br />

have a different and important role in connection with data security and privacy, which<br />

we are not considering here.) A good protection mechanism can make an important<br />

contribution to the detection and localization of bugs. A violation detected by the<br />

memory protection mechanism means that a program has gone berserk – usually<br />

because of a design flaw.<br />

To introduce the topic we will use the analogy of a large office block where many<br />

people work. Along with many other provisions <strong>for</strong> safety, there will usually be a number<br />

of fire walls and fire doors. What exactly is their purpose? People were once allowed<br />

to smoke in offices and public buildings. If someone in one office dropped a cigarette<br />

into a waste paper basket and caused a fire, the fire walls helped to save those in other<br />

offices. In other words, the walls limited the spread of damage. In computing terms,<br />

does it matter how much the software is damaged by a fault? – after all it is merely code<br />

in a memory that can easily be re-loaded. The answer is “yes” <strong>for</strong> two reasons. First, the<br />

damage caused by a software fault might damage vital in<strong>for</strong>mation held in files, damage<br />

other programs running in the system or crash the complete system. Second, the<br />

better the spread of damage is limited, the easier it will be to attempt some repair and<br />

recovery. Later, when the cause of the fire is being investigated, the walls help to pinpoint<br />

its source (and identify the culprit). In software terminology, the walls help find<br />

the cause of the fault – the bug.<br />

One of the problems in designing buildings is the question of where to place the firewalls.<br />

How many of them should there be, and where should they be placed? In software<br />

language, this is called the issue of granularity. The greater the number of walls,<br />

the more any damage will be limited and the easier it will be to find the cause. But walls<br />

are expensive and they also constrain normal movement within the building.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!