Programming languages for realtime systems extra slides, chapters 3 and 4

1 / 76
About This Presentation
Title:

Programming languages for realtime systems extra slides, chapters 3 and 4

Description:

(35% of total avionics development cost) Developed by 8 geographically separated subcontractors ... 12 major avionics subsystems. 650 Ada modules. Millions of ... –

Number of Views:39
Avg rating:3.0/5.0
Slides: 77
Provided by: vanste
Category:

less

Transcript and Presenter's Notes

Title: Programming languages for realtime systems extra slides, chapters 3 and 4


1
Programming languages for real-time
systems(extra slides, chapters 3 and 4)
  • talen die ik behandelAda, C, Java (en Real-Time
    Specification for Java)

2
intermezzo de taal Ada
  • taal ontworpen op aanvraag van DoD (Department
    of Defense, US)
  • naam Ada komt van Countess Augusta Ada Lovelace
  • dochter van dichter Lord Byron (England)
  • schreef programmas voor de Difference Engine
    van Charles Babbage, de eerste computer uit de
    geschiedenis
  • was hierdoor de eerste computerprogrammeur
  • volgende slides uit presentatie van DOD

3
Comments on Ada in Relation to C
Center for Computer Systems Engineering Joint
Interoperability Engineering Organization Defens
e Information Systems Agency
4
Why Ada? (Technical Arguments)
  • In 1976, nothing else existed, so...
  • Ada was designed with
  • Software engineering in mind
  • Large, complex projects in mind
  • Standardization/validation in mind
  • Reliability/maintainability in mind
  • In 1996, still nothing else exists!

Ada Was Designed With Long-term Support for the
Warfighter in Mind
5
IBM Weighted Scores for 6 Criterion Categories
Source IBM study, 1985
6
Do Defects Really Matter?
  • is 99.9 an acceptable tolerance for defects?
    Consider
  • Drinking water contaminated for 1 hour per month.
  • 16,000 letters lost every day by the US Post
    Office.
  • 2 accidents per month at OHare International
    Airport.
  • 20,000 prescriptions in error each year.
  • 50 babies dropped on the delivery room floor each
    hour.
  • 22,000 checks drawn from the wrong account per
    hour.

OOPS!
7
Software Crisis in 1976
  • Proliferation of languages (gt450)
  • Many dialects of standard languages
  • Low interoperability
  • High maintenance costs
  • Low reliability

Result Ada
8
Current State of Ada Use in DoD
SIGNIFICANT DECREASE IN No. OF 3GLs
(450)
NO. OF 3GLs
(37)
Ada is No. 1 For Weapons
Ada is No. 2 For AISs
Ada (33.5)
COBOL (59.2)
C (22)
Other (6.1)
Ada (22)
FORTRAN (13.2)
C 3.4
Other (10)
Jovial (9.3)
CMS-2 (12.5)
C (9)
9
Ada in Maintenance Arena
270,000 LOC
100 productivityand 50 qualityincrease
doesnot reduce Cto Ada levels
225,000 LOC
135,000 LOC
150,000 LOC
112,500 LOC
75,000 LOC
Source MITRE (Avionics domain)
10
Common Reasons for NOT Using Ada
  • If I ignore it it will go away!
  • Its too complex.
  • I dont have time to learn another language.
  • We dont have a compiler.
  • We need more tools to use Ada.
  • Its too expensive.
  • Blah, Blah, Blah!

11
Expected Benefits of Ada
  • Overall Advantage Increased Quality per Dollar
    Spent
  • Code Portability
  • People Portability
  • Maintainability
  • Reliability
  • Common Basis for Tools/Methodologies
  • Modularity, Managing Complexity
  • Management Visibility, System View
  • Improved Productivity
  • Increased Reusability

12
Why Ada? (Business Arguments)
  • Ada
  • Has better support for ilities
  • Yields greater productivity
  • Costs less per SLOC
  • Has fewer defects
  • Supported by multiple vendors
  • Ada represents
  • A DoD core competency
  • Increased economies of scale
  • An ISO and ANSI standard
  • Freedom from proprietary solutions

Ada Makes Open Systems and Interoperability
Possible
13
Why C?
  • Major industry marketing
  • Nothing equivalent for Ada
  • Object-oriented programming support
  • Did not exist in Ada 83, but does in Ada 95
  • Builds on popularity of C
  • C was free with UNIX operating systems
  • Students were taught C
  • Easier to move up to C than Ada
  • Tools, bindings, visual environments and support
    abundantly available (based on origin)
  • Ada was isolated

14
Why C?
  • Lower startup costs (, personnel, tools)
  • Ada delivers more and thus costs more when only
    development costs are considered
  • C gives programmers more freedom
  • Less discipline is attractive to programmers -
    dangerous on large systems
  • No standard for C
  • Ada vendors must meet standard - more difficult
    and more expensive

15
Why C for Industry?
Industry and DoD have different focus
DoD
Commercial Sector
  • sell many
  • quick reaction to market forces
  • large market
  • large profit potential
  • failures cost money
  • buy one
  • long-term planning precludes quick reaction
  • limited market
  • fixed profits
  • failures cost lives

Source Nyberg, Karl presentation quoting
Gensler, The Defense Industry and Aharonian,
Greg, Microeconomic Definitions for Ada Summit,
1994.
16
Software Development vs. Software Maintenance
  • DoD looks at systems from total lifecycle
    perspective
  • 60-80 of the lifecycle costs of software occur
    in maintenance
  • Arguments based on lower development costs total
    only 20-40 of the story
  • On most projects, development and maintenance are
    two separate contracts
  • Commercial Off-The-Shelf (COTS) software is not
    always the correct choice
  • Decisions must be made on lifecycle costs not on
    development costs

17
When Not to Use Ada
  • Ada may not be appropriate
  • When some other language has lower lifecycle
    costs
  • For some RD applications where the intent is for
    concept development only and the system will not
    be fielded
  • For some prototype applications, however the
    prototype must not be carried into ED for
    subsequent fielding
  • When a compiler does not exist for the hardware
    platform
  • When timing and/or sizing constraints make Ada a
    technical infeasibility

18
YF-22 Prototype Development
  • Software for the aircraft (35 of total
    avionics development cost)
  • Developed by 8 geographically separated
    subcontractors
  • Developed using
  • different Ada compilers
  • different hardware platforms
  • 12 major avionics subsystems
  • 650 Ada modules
  • Millions of SLOC
  • Integrated in 3 days!

Source Guidelines for Successful Acquisition and
Management of Software Intensive Systems, Vol. I,
USAF, Feb 1995
19
Summary Ada vs C
2002
  • Ada is
  • Technically superior
  • Demonstrably lower in cost through entire
    lifecycle
  • Successfully used today and growing
  • Supported by DISA

Ada was explicitly designed to support large
systems well into this century
20
hoofdstuk 3kort overzicht van Ada, C en
Javaprogramming in the small
21
belang van goede syntax
  • (oud) voorbeeld van een slechte syntax Fortran

lus tot label 20, iteratie van I van 1 tot 100
DO 20 I 1, 100
een programmeur schreef voor de U.S. Viking
Venus Probe DO 20 I 1. 100 de compiler
interpreteerde dit als een toekenning en negeerde
de blancos DO20I 1.100 variabelen hoeven
niet gedeclareerd te worden in Fortran, en de
variabelen die met een D beginnen worden
verondersteld reals te zijn (met de D van double)
en 1.100 is een real !
22
algemene stijl een blok in Ada
  • declare
  • ltdeclarative partgt
  • begin
  • ltsequence of statementsgt
  • exception
  • ltexception handlersgt -- voor het behandelen van
    fouten, zie H6
  • end
  • declare
  • Temp Integer A -- initiële waarde wordt
    gegeven aan Temp
  • begin
  • A B -- is de toekenningsoperator
  • B Temp
  • end -- in dit voorbeeld geen exception deel

23
algemene stijl een blok in C
algemene stijl een blok in C en Java
  • ltdeclarative partgt
  • ltsequence of statementsgt
  • int temp A / declaratie en initialisatie /
  • / merk op in C, Java staat naam van type
    eerst /
  • / in Ada komt het na de naam van de
    variabele /
  • A B / toekenningsoperator is /
  • B temp
  • / Java eventueel ook exception handlers,
    zie H6 /

24
gegevenstypen
gegevenstypen
  • Ada is sterk getypeerd in toekenningen en
    expressies moeten objecten van hetzelfde type
    zijn (expliciete conversies zijn mogelijk)
  • Java is ook sterk getypeerd (toekenning mag enkel
    indien geen informatie verloren gaat, bv int naar
    long)
  • C biedt veel minder type-controle (bv int kan
    toegekend worden aan short int)
  • sterke typering bevordert betrouwbaarheid de
    compiler kan testen op consistent gebruik van
    gegevens
  • volgende slides vb van zwakke en sterke typering

25
types in C
types in C
  • typedef enum (xplane, yplane, zplane) dimension
  • / typedef introduceert een naam voor een nieuw
    type /
  • / de naam is hier dimension /
  • / enum zegt dat het om een enumeratie gaat /
  • dimension line, force
  • line xplane
  • force line 1
  • / force is nu yplane /
  • / 1 wordt hier in volledig andere betekenis
    gebruikt dan normaal /
  • Java biedt geen enumeratie type

26
types in Ada
types in Ada
  • type Dimension is (Xplane,Yplane,Zplane)
  • type Map is (Xplane,Yplane)
  • Line, Force Dimension
  • Grid Map
  • begin
  • Line Xplane
  • Force DimensionSucc(Xplane)
  • Grid Yplane
  • Grid Line -- mag niet, verschillende types
  • end

27
types in Ada (vervolg)
types in Ada
  • subtype Surface is Dimension range Xplane ..
    Yplane
  • type New_int is new Integer
  • type Projection is new Dimension range Xplane ..
    Yplane
  • D Dimension
  • S Surface
  • P Projection
  • begin
  • D S -- OK
  • S D -- legaal, maar zou kunnen run-time
    fout genereren
  • P D -- illegaal
  • P Projection(D) -- OK, met expliciete
    conversie
  • end

28
types in C (vervolg)
types in C en Java
  • in C
  • typedef int newint
  • typedef dimension projection
  • / biedt niet dezelfde protectie als in Ada /
  • / typedef is synoniem voor een ander type, geen
    afgeleid type /
  • in Java
  • nieuwe types worden gecreëerd via
    object-oriëntatie, zie H4

29
gestructureerde gegevenstypes in Ada
  • Max constant Integer 10
  • type Reading_T is array (0 .. Max-1) of Float
  • Size constant Integer Max-1
  • type Switches_T is array(0 .. Size, 0 .. Size) of
    Boolean
  • Reading Reading_T
  • Switches Switches_T

30
gestructureerde gegevenstypes in C
gestructureerde gegevenstypes in Java
  • static final int max 10 // definitie van
    constante
  • float reading new float MAX // index is 0
    .. max -1
  • boolean switches new booleanMAX MAX
  • // merk op in Java zijn rijen objecten

31
gestructureerde gegevenstypes in C
gestructureerde gegevenstypes in C
  • define MAX 10 / manier om een constante te
    definiëren /
  • / zonder typevoordeel /
  • typedef float reading_tMAX / index is 0 ..
    MAX-1 /
  • typedef short int switches_tMAX MAX
  • / er zijn geen booleans in C /
  • reading_t reading
  • switches_t switches

32
dynamische gegevenstypes in C
dynamische gegevenstypes in C
  • typedef struct node
  • int value
  • struct node next / pointer naar een
    record hier gedefinieerd /
  • node_t
  • int V
  • node_t Ptr
  • Ptr malloc (sizeof(node_t)) / dynamische
    allocatie van geheugen /
  • Ptr-gtvalue V
  • Ptr-gtnext 0 / de null-pointer bestaat niet
    /
  • ...

33
dynamische gegevenstypes in Ada
dynamische gegevenstypes in Ada
  • type Node -- definitie zal volgen
  • type Ac is access Node
  • type Node is
  • record
  • Value Integer
  • Next Ac
  • end record
  • V Integer
  • A1 Ac
  • begin
  • A1 new Node -- dynamische allocatie van
    geheugen
  • A1.Value V
  • A1.Next null
  • . . .
  • end

34
dynamische gegevenstypes in C (vervolg)
dynamische gegevenstypes in C
  • typedef date_t events_tMAX, next_event_t
  • / events_t is een type voor arrays van Max el.
    van type date_t
  • next_event_t is type voor pointers naar el.
    van type date_t /
  • events_t history
  • next_event_t next_event
  • next_event history0 / adres van eerste
    element van rij /
  • next_event / de pointer gaat nu wijzen
    naar het /
  • / volgende element in de rij /
  • / een pointer in C kan naar om het even wat
    wijzen, probleem van
  • hangende pointers (dangling pointer) /

35
dynamische gegevenstypes in C (vervolg)
dynamische gegevenstypes in Java
  • elk object in Java is een referentie naar het
    actuele object met zijn data, voor de rest zijn
    er geen pointers voorzien in Java
  • class node
  • int value
  • node next
  • Node Ref1 new Node()
  • Node Ref 2 new Node()
  • if (Ref1 Ref2) // vergelijkt adressen
    en geen inhoud

36
controle structuren leeg blok
controle structuren leeg blok
  • in Ada
  • begin
  • null
  • end
  • in Java en C
  • / gewoon niets /

37
controle structuren if-then-else
controle structuren if-then-else
  • in Ada
  • if A / 0 then
  • if B/A gt 10 then
  • High True
  • else
  • High False
  • end if
  • end if

in C if (A ! 0) if (B/A gt 10) high 1 else
high 0 // in Java mag die ambiguïteit
niet if (A ! 0) if (B/A gt 10) high
1 else high 0
38
controle structuren if-then-else in Ada (vervolg)
controle structuren if-then-else in Ada
  • if Number lt 10 then
  • Num_Digits 1
  • elseif Number lt 100 then
  • Num_Digits 2
  • elseif Number lt 1000 then
  • Num_Digits 3
  • elseif Number lt 10000 then
  • Num_Digits 4
  • else
  • Num_Digits 5
  • end if

39
controle structuren while-lus
controle structuren while-lus
in Java en C while (ltexpressiongt) /
expressie 0 eindigt lus / ltstatementgt whil
e (1) ... if (ltexpressiongt) break ...
  • in Ada
  • while ltBoolean Expressiongt loop
  • ltStatementsgt
  • end loop
  • loop
  • ...
  • exit when ltBoolean Expressiongt
  • ...
  • end loop

40
controle structuren for-lus en oneindige lus
in Java en C for (i 0 i lt 9 i) Ai
i while (1) ltstatementgt
  • in Ada
  • for I in 0 .. 9 loop
  • A(I) I
  • end loop
  • loop
  • ltStatementsgt
  • end loop

41
parameters bij subprogrammas in Ada
parameters bij subprogrammas in Ada
  • drie modes
  • in data wordt doorgegeven aan het subprogramma
  • out data wordt doorgegeven aan het
    oproepende programmaonderdeel
  • in out data wordt doorgegeven aan het
    subprogramma, wordt daar eventueel gewijzigd en
    wordt dan weer doorgegeven aan het oproepende
    programma- onderdeel
  • procedure Quadratic ( A, B, C in Float
  • R1, R2 out Float
  • Ok out Boolean)
  • bij functies mogen alleen in parameters
    gebruikt worden

42
parameters bij subprogrammas in C
parameters bij subprogrammas in C
  • maar 1 parametermechanisme
  • by value data wordt enkel doorgegeven aan het
    subprogramma
  • om resultaten te doen terugkeren naar het
    oproepende programmaonderdeel moeten pointers
    gebruikt worden
  • void quadratic ( float A, float B, float C,
  • float R1, float R2, int OK)
  • merk op
  • - C heeft geen sleutelwoord om een subprogramma
    aan te geven
  • - een procedure in C is een functie die niets
    (void) terug geeft

43
parameters bij subprogrammas in C
parameters bij subprogrammas in Java
  • primitieve argumenten worden gekopieerd
  • variabelen van classe-type
  • zijn reference variabelen, worden doorgegeven
    als referentie
  • argument dat niet mag gewijzigd worden door
    functie final
  • public class Roots
  • float R1, R2
  • boolean quadratic ( final float A, final float B,
    final float C, Roots R)
  • merk op
  • - de boolean vlag is de teruggeefwaarde van de
    functie
  • - Roots is een klasse R1 en R2 kunnen gewijzigd
    worden

44
procedures in Ada
procedures in Ada
  • procedure Quadratic (A, B, C in Float
  • R1, R2 out Float
  • Ok out Boolean) is
  • Z Float
  • begin
  • Z BB - 4.0AC
  • if Z lt 0.0 or A 0.0 then
  • Ok False
  • R1 0.0 R2 0.0
  • return
  • end if
  • Ok True
  • R1 (-B Sqrt(Z)) / (2.0A)
  • R2 (-B - Sqrt(Z)) / (2.0A)
  • end Quadratic

45
procedures in C
procedures in C
  • void quadratic ( float A, float B, float C,
    float R1, float R2, int OK)
  • float Z
  • Z BB - 4.0AC
  • if (Z lt 0.0 A 0.0)
  • OK 0
  • R1 0.0 R2 0.0
  • return
  • OK 1
  • R1 (-B SQRT(Z)) / (2.0A)
  • R2 (-B - SQRT(Z)) / (2.0A)
  • ...
  • quadratic (F1, F2, F3, Q1, Q2, S)

46
procedures in C
procedures/functies in Java
  • public class Roots
  • float R1, R2
  • boolean quadratic ( final float A, final float B,
    final float C, Roots R)
  • float Z
  • Z (float) (BB - 4.0AC)
  • if (Z lt 0.0 A 0.0)
  • R.R1 0f
  • R.R2 0f
  • return false
  • R.R1 (float) (-B Math.sqrt(Z)) / (2.0A)
  • R.R2 (float) (-B - Math.sqrt(Z)) / (2.0A)
  • return true

47
functies in Ada
functies in Ada
  • function Minimum (X, Y in Integer) return
    Integer is
  • begin
  • if X gt Y then
  • return Y
  • else
  • return X
  • end if
  • end Minimum

48
functies in C
functies in C
  • int minimum (int X, int Y)
  • if (X gt Y) return Y
  • else return X
  • voorbeeld van een macro (en tegelijk ook van
    mogelijk cryptische schrijfwijze van if-then-else
    in C)
  • define MIN(X, Y) ((X gt Y) ? (Y) (X))

49
intermezzoJava for (real-time and) embedded
systems
50
ontwikkeling van embedded SW in Java
  • overzicht technologie en architectuur
  • waarom Java ?
  • Java Virtual Machine technologie
  • alternatieve technologieën
  • ondersteunende technologieën

51
wat is zo fantastisch aan Java ?
  • programmeringstaal
  • bekend C-achtige (maar verbeterde) syntax
  • alle test condities moeten Boolean zijn
  • vb while (x3) is niet toegelaten
  • primitieve data types hebben vaste lengte
  • gemmakkelijker om bug-vrije software te schrijven
  • testen op grenzen van arrays
  • automatische garbage collection
  • geen expliciete pointers - geen dangling pointers
  • ingebouwde exception-handling
  • ingebouwde bibliotheek voor concurrency
  • echt object-georienteerd
  • eenvoudiger om te leren dan C

52
compileren vs interpreteren
  • compileren (vertalen)
  • vertalen van programma in een hogere
    programmeertaal
  • naar machine code
  • met gepaste oproepen naar een besturingssysteem
  • resultaat heet object code
  • object code is niet draagbaar
  • object code wordt verdeeld, bron code is
    beschermd
  • programma wordt volledig vertaald voordat het
    uitgevoerd wordt
  • één maal vertalen, ontelbare keren uitgevoeren
  • linken (bij grote programmas)
  • elk onderdeel van een groter programma wordt
    apart vertaald
  • verschillende onderdelen worden samen gelinked

53
compileren vs interpreteren
  • interpreteren (vertolken)
  • een programma wordt tijdens de uitvoering, regel
    per regel vertaald en uitgevoerd
  • vertaling gebeurt bij elke uitvoering vertraging
  • bij een lus worden de instructies even vaak
    vertaald als er iteraties zijn nog extra
    vertraging
  • programma is draagbaar
  • bron code wordt verdeeld (nadeel voor verkopers)
  • tijdswinst bij ontwikkeling
  • stukjes programma kunnen uitgevoerd worden
  • geheel hoeft niet gecompileerd te worden

54
wat is zo fantastisch aan Java ?
  • bytecodes
  • Java bytecode draagbaar binair formaat
  • instructie set voor een virtuele machine
  • draagbaar over platformen heen, zonder bron code
  • bron code vertaling wordt vantevoren gedaan
  • sneller dan een volledig geïnterpreteerde
    oplossing
  • kan vertaald worden in machinetaal
  • bij elk voorkomen (bytecode interpreter)
  • bij eerste voorkomen (just-in-time compiler)
  • voor het laden (ahead-of-time compiler)

55
wat is zo fantastisch aan Java ?
Java Source
Java bytecode
libraries
Java compiler
Java bytecode
56
wat is zo fantastisch aan Java ?
  • class libraries
  • hoog niveau van abstractie
  • standaard APIs
  • verhogen draagbaarheid van toepassingen
  • verlagen programmingskost
  • ondersteuning voor multitasking (zie H 7-9)
  • Thread class en Runnable interface
  • synchronized keyword
  • monitors via wait() en notify()
  • ondersteuning voor networking

57
waarom iets anders gebruiken ?
  • problemen met Java
  • geen directe toegang tot hardware (zie H 15)
  • Java heeft geen pointers
  • ook geen bytecodes voor toegang tot fysische
    adressen
  • maar Java kan C oproepen! (Java Native Methods)
  • grootte van code JVM kan enorm zijn
  • inefficiënties
  • bytecode interpretatie is langzamer dan C/C
  • garbage collection vraagt processor tijd
  • interpreter of JIT is misschien niet de
    optimale compiler
  • onvoorspelbaarheid (zie H 13)
  • garbage collector kan een running taak pre-empten
  • Just-in-Time compilatie vertraagt eerste toegang

58
JVM technologie componenten
Java Threads
C/C Tasks
Class libs
Java Virtual Machine ( garbage collector)
Multitasking OS
Processor and other hardware
59
in een virtuele machine
60
in een virtuele machine
  • execution engine
  • bytecode interpreter
  • just-in-time compilatie
  • hybried
  • bv Suns HotSpot compiler

61
in een virtuele machine
  • garbage collector (grootste mythe voor Java)
  • veel algoritmen, sommige geschikt voor hard RT
  • naïeve methoden
  • incrementele methoden
  • real-time (dubbele heap, HW ondersteund)
  • met bovengrens voor worst-case allocatie tijd
    (sneller dan incrementele GC)
  • met bovengrens voor worst-case object
    toegangstijd
  • tragere gemiddelde allocatie tijd
  • tragere object toegangstijd

62
in een virtuele machine
  • dynamische Class Loader
  • vind en laad verwezen klasse
  • lees file ltpackagegt/ltclassgt.class in CLASSPATH
  • ZIP files zijn doorzoekbaar, kunnen in ROM,
    indien nodig
  • verifiëren van class file formaat
  • link plaats inhoud in een JVM data structuur
  • voorbereiden en initialisatie van klassen

63
in een virtuele machine
  • bytecode verificatie
  • detecteert en voorkomt illegale activiteit
  • verificatie is optioneel!
  • heeft weinig zin in een gesloten systeem

64
in een virtuele machine
  • Java Class Libraries
  • Write Once, Run Anywhere
  • alleen indien zelfde set class libraries
    beschikbaar zijn!
  • meerdere standard platforms (APIs)
  • Standard Java - volledige set, voor desktops /
    werkstations
  • PersonalJava - deelverzameling, voor kleinere
    devices
  • EmbeddedJava - analoog aan vorige, maar meer
    geheugen-bewust

65
in een virtuele machine
  • Java Class Libraries
  • opwaartse compatibiliteit
  • EmbeddedJava toepassingen draaien op een
    PersonalJava platform
  • PersonalJava applications draaien op een Standard
    Java platform

66
JVM vereisten geheugen
  • ROM JVM libraries application
  • JVM 500K is een typisch maximum
  • Class libraries 500K voor PersonalJava
  • de applicatie zelf
  • RAM JVM heap thread stacks
  • wordt beïnvloed door het engine type
  • JIT compiler vraagt groot geheugen, interpreter
    niet
  • heap size is applicatie-afhankelijk
  • elke thread vraagt een eigen stack

67
JVM vereisten processor
  • mogelijkheden
  • rekenmogelijkheden
  • 32-bit integers verondersteld goedkoop en snel
  • 64-bit moet kunnen
  • 32-bit and 64-bit floating point (IEEE 754)
    beschikbaar
  • processorkracht
  • genoeg om vertraging van interpretatie aan te
    kunnen
  • addresruimte
  • JVM alle class libraries vragen veel geheugen !

68
JVM vereisten besturingssysteem
  • JVM is (meestal) niet vervanging van
    besturingssysteem
  • RTOS of andere kernel wordt eronder verwacht
  • alleen minimale functionaliteit wordt hiervan
    verwacht
  • thread creatie en vernietiging (zie H 7)
  • synchronizatie primitieven (vb mutexes) (zie H 8)
  • een stapel voor elke thread (zie H 7)
  • prioriteits-gebaseerde scheduling (zie H 13)
  • tenminste 10 prioriteitsniveaus

69
JVM vereisten andere SW
  • JVMs zijn geschreven C, daarom is nodig
  • Standard C library
  • Standard math library
  • dynamische geheugen allocatie
  • malloc() wordt intern opgeroepen
  • Java class libraries
  • java.net - veronderstelt een TCP/IP stapel
  • java.awt - veronderstelt een grafische API
  • andere ? - implementatie-specifiek

70
alternatieve technologieën
  • traditionele JVM
  • te groot
  • te traag
  • te onvoorspelbaar
  • alternatieven
  • Ahead-of-time compilers
  • Just-in-time compilers (JIT-compiles)
  • Java processoren
  • JavaCard technologie

71
ondersteunende technologieën
  • Java Native Interface (JNI)
  • oproepen van legacy code
  • work around rond Javas tekortkomingen
  • implementeert performante functionaliteit
  • native methods C functies (geen goede
    integratie met C)

72
RTSJ missie
  • RTSJ Real-Time Specification for Java
  • missie

To extend The Java Language Specification and
The Java Virtual Machine Specification to
provide an Application Programming Interface
that will enable the creation, verification,
analysis, execution, and management of Java
threads whose correctness conditions include
timeliness constraints (also known as real-time
threads).
73
RTSJ ontstaan - timing
  • December 1998 JSR-0001 initiated
  • Sun, IBM en verkopers uit RTOS community
  • Oktober 1999 Community Review draft
  • weinig details nog veel problemen
  • Juni 2000 Public Release als boek
  • nog altijd weinig details - nog altijd veel
    problemen
  • November 2001 JSR final approval
  • Referentie Implementatie door TimeSys
  • Januari 2002 Officiele finale release V1.0
  • geen echte wijzigingen
  • gt Januari 2002
  • Technical Interpretation Committee gaat
    aanpassingen doen
  • V1.01

74
RTSJ relatie met boek
  • auteur van boek betrokken bij RTSJ
  • in boek gaat soms over JAVA, soms over RTSJ
  • boek is van 2001, dus vóór final release
  • er zijn kleine verschillen tussen boek in final
    release
  • van geen belang voor ons

75
RTSJ guiding principles
  • WOCRAC (zoals WORA maar anders)
  • Write Once Carefully Run Anywhere Conditionally
  • Temporeel voorspelbare uitvoering
  • moet Current Practice ondersteuning
  • moet Leading Edge ondersteunen (dus alle
    nieuwste dingen)
  • geen syntactische uitbreidingen (geen nieuwe
    keywords bv)
  • moet toelaten om implementatie trade-offs te
    maken
  • van spel-versies tot Cruise Missiles
  • Incentive voor RTOS vendors

76
RTSJ sleuteldomeinen
  • Thread Scheduling Dispatching (H7, H13)
  • Synchronization and Resource Sharing (H8)
  • Memory management (H15)
  • including Physical Memory Access
  • Asynchronous Actions (H10)
  • Asynchronous Event Handling
  • Asynchronous Transfer of Control
  • Asynchronous Thread Termination
  • Time, Clocks and Timers (H12)
Write a Comment
User Comments (0)
About PowerShow.com