Learning to think co-operatively

Introduction

Using a co-operative scheduler in your application has a number of benefits, one of which being that the development process is simplified. However, to get the maxi- mum benefit from the scheduler you need to learn to think ‘co-operatively’.

For example, one key difference between scheduled and desktop applications is the need to think carefully about issues of timing and task duration. More specifically, as we saw in Chapter 14, a key requirement in applications using a co-operative sched- uler is that – for all tasks, under all circumstances – the task duration, DurationTask,

must satisfy the following condition:

DurationTask < Tick Interval

The patterns in this chapter are intended to help you meet this condition by ensur- ing that tasks will abort if they cannot complete within a specified period of time. Specifically, two timeout patterns are presented here:

LOOP TIMEOUT [page 298]

HARDW ARE TIMEOUT [page 305]

Leave a comment

Your email address will not be published. Required fields are marked *