JAVA-BASED REAL-TIME PROGRAMMING
JAVA-BASED REAL-TIME PROGRAMMING
JAVA-BASED REAL-TIME PROGRAMMING
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 2<br />
Fundamentals<br />
Goal: Review of basic properties of software execution as a preparation<br />
for dealing with concurrency and real-time issues.<br />
Already having some programming experience means that you, dear reader,<br />
have a lot of knowledge about how a computer interprets or executes a computer<br />
program. When you know it, it is all natural, and most programmers<br />
are not aware of the insights they have gained. We are now about to write<br />
programs that behave concurrently even if we only have one processor. Before<br />
doing so, it could be a good idea to take a step back and review the basic<br />
properties of program execution. This is the first thing that will be done in<br />
this chapter. Then, different notions of concurrency in hardware and software<br />
will be treated. Finally, we state the duties of the software systems we are<br />
about to develop.<br />
The eager and experienced programmer may skip this chapter, but beware,<br />
you may be a very skilled programmer without having the profound<br />
understanding you think you have.<br />
2.1 Software execution is performed sequentially<br />
To recall the sequential nature of program execution, assume you write an<br />
ordinary program to be run on an ordinary computer having one processor<br />
(CPU). A piece of the code may look as shown in Figure 2.1, so what value<br />
will x have after leaving the loop?<br />
You know that the resulting value of x will be one. The novice answering<br />
zero believes that the loop-condition is continuously evaluated in parallel with<br />
evaluation of the expressions in the loop. Thus, the fact that the computer<br />
treats our instructions sequentially one after another cannot be considered<br />
natural to all of us; some of us have just learned that this is the way it works.<br />
Actually, it is a severe restriction that only one thing at a time can be done.<br />
17