Real-Time and Embedded Systems

Synchronous C and Java (SC and SJ)

Synchronous C and Java (SC and SJ), also referred to as SyncCharts in C/Java, is a light-weight mechanism to express reactive control flow in C or Java programs.

SC/SJ combines the formal soundness of SyncCharts, including deterministic concurrency and preemption, with the efficiency and wide support for the C/Java language. To write and execute an SC/SJ application requires neither specific tools nor special execution platforms, although both may support this concept further. All that is needed to get started is an understanding of SyncCharts (see eg the tutorial provided by André [2003]) and of their implementation in SC as described by von Hanxleden [2009], the SC files available here and a C or Java compiler. To develop an SC application, one has to write some <application>.c/java that mainly defines a tick function that controls state behavior. The tick function consists of regular C/Java code combined with SC/SJ operators, defined as C macros or Java methods.

The main idea of SC/SJ is to emulate multi-threading, inspired by reactive processing [Li and von Hanxleden 2010]. As we do not have direct access to the program counter at the C/Java language level, we keep track of individual threads via state labels. Precedence among transitions, respecting strong/weak abortions and hierarchy, and the adherence to signal dependencies is achieved by checking transition triggers in the proper order as well as assigning appropriate thread ids and priorities.

SC/SJ's conciseness, completeness and semantic closeness to SyncCharts make it an attractive candidate for a number of scenari

  1. As a regular programming language, requiring just a C/Java compiler, no special tools or hardware;
  2. As an intermediate target language for synthesizing graphical SyncChart models into executable code, in a more traceable manner than the traditional path through Esterel;
  3. As instruction set architecture for programming precision timed (PRET) or reactive architectures; or
  4. As a virtual machine instruction set.

 Download

The SC code is open source under a "two-clause BSD license" (see license) and is free for all uses. The current release can be downloaded here (version information). The whole tar ball, including examples, is about 20 KBytes. Yes, we do mean light-weight!

The release includes:

  • sc.h - a header file to be included in SC applications, which defines the SC operators (includes release history)
  • sc.c - a file to be linked in by SC applications, which defines dispatcher routines and the main function that controls overall execution
  • selectCid.c - dispatcher routines (fragment of sc.c, without main)
  • Makefile
  • Several example .c files and the output produced by them (see [André 2003])

 

Doxygen documentation of the SC files: html, pdf

Mailing List

To keep informed about developments on SC and SJ, you can subscribe to the rt-sc-sj mailing list.

Links


Documentations/References

  • [von Hanxleden 2009a] Reinhard von Hanxleden. SyncCharts in C - A Proposal for Light-Weight, Deterministic Concurrency. In Proceedings of the International Conference on Embedded Sofware (EMSOFT’09), Grenoble, France, October 2009. (pdf, bib)
    An extended abstract of [von Hanxleden 2009]
  • [von Hanxleden 2009] Reinhard von Hanxleden. SyncCharts in C. Technical Report 0910, Department of Computer Science, Christian-Albrechts-Universität zu Kiel, May 2009, Revised September 2009. (pdf, bib)
    Describes SC in fair detail. The draft revision is based on SC Release 1.4., the original report (pdf) is based on SC Release 1.2.
  • [Li and von Hanxleden 2010] Xin Li and Reinhard von Hanxleden. Multi-Threaded Reactive Programming—The Kiel Esterel Processor. IEEE Transactions on Computers, accepted, 2010. (pdf, bib)
    Describes the Kiel Esterel Processor, whose processing model is the inspiration for SC.
  • [André 2003] Charles André. Semantics of SyncCharts. Technical Report ISRN I3S/RR-2003-24-FR, I3S Laboratory, Sophia-Antipolis, France, April 2003. (pdf)
    A good starting point to get a solid understanding of SyncCharts. Most of the examples provided with the SC distribution are taken from this report.

 

SC/SJ

(larger version)