View Full Document

7 views

Unformatted text preview:

Chapter 5 from C Brooks E A Lee X Liu S Neuendorffer Y Zhao H Zheng Heterogeneous Concurrent Modeling and Design in Java Volume 2 Ptolemy II Software Architecture Technical Memorandum UCB ERL M04 16 University of California Berkeley CA USA 94720 June 24 2004 Type System Authors Edward A Lee Steve Neuendorffer Yuhong Xiong 5 1 Introduction The computation infrastructure provided by the basic actor classes is not statically typed i e the IOPorts on actors do not specify the type of tokens that can pass through them This can be changed by giving each IOPort a type One of the reasons for static typing is to increase the level of safety which means reducing the number of untrapped errors 26 In a computation environment two kinds of execution errors can occur trapped errors and untrapped errors Trapped errors cause the computation to stop immediately but untrapped errors may go unnoticed for a while and later cause arbitrary behavior Examples of untrapped errors in a general purpose language are jumping to the wrong address or accessing data past the end of an array In Ptolemy II the underlying language Java is quite safe so errors rarely if ever cause arbitrary behavior 1 However errors can certainly go unnoticed for an arbitrary amount of time As an example figure 5 1 shows an imaginary application where a signal from a source is downsampled then fed to a fast Fourier transform FFT actor and the transform result is displayed by an actor Suppose the FFT actor can accept ComplexToken at its input and the behavior of the DownSample actor is to just pass every Source DownSample FFT Display FIGURE 5 1 An imaginary Ptolemy II application 1 Synchronization errors in multi thread applications are not considered here Heterogeneous Concurrent Modeling and Design 113 Type System second token through regardless of its type If the Source actor sends instances of ComplexToken everything works fine But if due to an error the Source actor sends out a StringToken then the StringToken



Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Type System and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Type System and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?