Information Technology Reference
In-Depth Information
Once deadlock occurs on a system, it will stay in that condition unless there is
outside intervention and the easiest way to deal with deadlock is to avoid it. The
four conditions are as follows: mutual exclusion, circular wait, no preemption, and
hold and wait. If the rules for requesting a resource are modified so that one of
these conditions can never occur, then deadlock will not occur. Some conditions are
easier to remove than others; for example, if there is only one resource, the mutual
exclusion condition cannot be removed. However, the hold and wait condition can
be avoided by implementing a rule that requires a task to request all resources if they
are available. If one of the resources is not available, then the task does not request
any. The section of code where the task is requesting resources is a critical section of
code because it must not be interrupted until it has all resources.
3.6
TIMERS
These include the watchdog timer and the system timer.
3.6.1
Watchdog Timer
Timers are an essential part of a real-time system. One of the most critical timers
is called the watchdog timer. This timer is responsible for making sure that tasks
are being serviced by their deadlines. The watchdog timer can be implemented in
hardware, where counters are increasing until an upper limit is reached. This upper
limit value depends on the system requirements. For example, if all tasks must
complete within a 100 ms time limit, the upper limit can be set at 100 ms. If the limit
is reached, it causes a system reset. To avoid system reset, the timer must be cleared.
The clearing of the watchdog timer can occur at the end of the longest task because
this would indicate that all tasks have completed execution.
3.6.2
System Timer
Other timers in real-time systems cause a task to begin execution. If a task is scheduled
to run every 1 ms, there must be a timer associated with this task that initiates the
task to run after the time has expired.
With round-robin scheduling, each task has a certain time quantum in which it has
to execute its instructions. The timer begins when the task is scheduled, and after its
time quantum has expired, an interrupt occurs causing a context switch and the task
is replaced by the next scheduled task.
3.7
CONCLUSION
This chapter has addressed the past and present design techniques for real-time
systems, but future designs tend to be moving toward Network-on-Chip or moving
some tasks that usually reside solely on the microprocessor to a field-programmable
gate array (FPGA) device.
Search WWH ::




Custom Search