Real-time Java, Part 5: the preparation and deployment of real-time Java applications

  Level: Intermediate 

  Caroline Gough (goughc@uk.ibm.com), software engineers, IBM 
  Andrew Hall (andhall@uk.ibm.com), software engineers, IBM Hursley Lab 
  Helen Masters (helen_postlethwaite@uk.ibm.com), software engineers, IBM Hursley Lab 
  Alan Stevens (alan_stevens@uk.ibm.com), software engineers, IBM Hursley Lab 

  July 11, 2007 

  This article is to discuss the six-JavaT ™ part series of articles in Part 5, and has demonstrated how to use IBM WebSphere Real Time with the tools to prepare and deploy real-time Java applications.    The author used examples of applications, and has demonstrated to control garbage collection suspended Metronome refuse collection, to avoid run-time compiler for the suspension of pre-compiler (Ahead-of-time compiler), as well as to meet the most pressing time NoHeapRealtimeThread demand. 

  Before this series of several articles on the IBM WebSphere Real Time how to solve the problem of uncertainty, thus the timescale was very low value (delay value).    This feature will be the Java platform and the scope of expansion to the original receipts only apply to specific real-time (RT) programming languages (such as Ada) in the field.    RT hardware and operating systems are often customized, incomprehensible.    With different WebSphere Real Time running on the IBM BladeCenter ® LS20 compatible (see references) and similar hardware on the Linux ® RT version.    It supports the typical RT application requirements: 

  •   Low: to ensure that in the limited time response signal. 

  •   Certainty: There is no garbage collection (GC) suspended indefinitely. 
  •   Predictable: thread priority implementation of the frequency of monitoring, implementation time line. 
  •   No priority inversion: high-priority thread not in the priority thread is running, its been a lock for the low priority thread obstruction. 
  •   Physical memory of the visit: such as device drivers such as RT always require retroactive application root. 

  This article demonstrates how to use WebSphere Real Time provides the tools to prepare and deploy RT Java applications.    Cited in the text before the article of this series, to demonstrate how to make the process to a higher level of uncertainty RT implementation.    (This could be helpful, but before reading the article is not necessary.) You will see how to use a strategy RT GC (Metronome) in WebSphere Real Time attached Lunar Lander examples of applications in improving the predictability.    You will also learn how to pre-compiler (AOT) your application, in order to improve the environment of an RT uncertainty.    Finally, you will not refuse collection for the use of the control of the design and realization of a memory RT applications, found your RT Java applications to maximize the effectiveness of tips and techniques. 

  If you want to run this paper, certain procedures - of course, it is best to prepare your own RT Java applications - then you need to visit an installed WebSphere Real Time System (on access to the technology more information, See references). 

  NoHeapRealtimeThread such as the one presented above, this will bring some challenges to improve the preparation of reliable Java application threshold.    There is another alternative, apply to many to be tolerated very short suspension RT applications, RT is the use of a garbage collector, for example, WebSphere Real Time in Metronome. 

  Metronome use applications running Lunar Lander lunar lander will lead to closer to the correct location of the place, and a high degree of measurement will not have any significant peak to ensure that each landed safely (see Figure 3). 

  references), shown in Figure 4: 

  "real-time Java, Part 2: Comparison of compiler technology" to better understand the JIT compiler for the implementation of optimization technology, JIT and AOT their respective advantages and disadvantages, as well as the two contrast. 

  reference, access online InfoCenter links).    It will guide you to a discussion on the Lunar Lander generate runtime configuration file, how will you use this document to selectively pre-compiled Lunar Lander application and system JAR file.    In addition, if you would like to try another pre-compiled applications, can also use the next section to discuss the Sweet Factory applications. 


  single rule).    Management of shared scope is not simple, because a scope only when all the threads left when it can be recycled.    That is to say, the size must be reasonable scope settings to allow multiple threads at the same time carry out its mandate. 

总之,如果您坚持一次对一个线程上的一个任务使用一个作用域,使用NHRT 进行开发就比较简单。例如,每个生产线轮询线程都将在不朽内存中启动,查询ProductionLine之前,要为其预先创建一个作用域。每个筛选池线程都将在不朽内存中启动,并使用栈上的原始数据进行计算。每个线程都将有一个作用域可进入,如果它需要使用WorkerConsole接口(对象将在其中创建)。

实时Java,第3 部分: 线程化和同步 ”。

RTSJ 提供了一种在NHRT 和基于堆的线程间共享数据的解决方案,那就是WaitFreeQueue类。这些类是具有无等待端的队列,在这里,一个NHRT 可以请求读或写某些数据(具体取决于类),而不存在阻塞的风险。队列的另一端使用传统的Java 同步,由堆线程使用。通过避免非堆和基于堆的环境中的锁,我们就可以安全地交换数据了。

我们的MeasurementManager将由NHRT 用于获取度量结果,由基于堆的审计线程用于返回度量结果。因此,我们使用一个WaitFreeReadQueue来管理此结构。 WaitFreeQueue的无等待端专门设计成单线程。 WaitFreeReadQueue则为多个写入方、单一读取方的应用程序而设计。我们使用的是多个读取方、单一写入方的应用程序,因此必须添加自己的同步,来确保同一时间只有一个NHRT 请求一个度量结果。这看似因添加额外的同步而违背了使用WaitFreeQueue的目的。但监控器控制read()方法的访问将仅在NHRT 间共享,因而不会存在堆和非堆上下文中的危险锁共享。

这就带来了NHRT 应用程序开发中的又一大挑战,为在非堆环境中使用而重用现有部分Java 代码变得无比艰难。如您所见,您被迫谨慎考虑从何处分配每个对象以及如何避免内存泄漏。总体上来说,Java 语言和面向对象编程的一大优势—— 实现细节的封装—— 在非堆环境中变成了一大薄弱环节,因为您不再能够预测和管理内存使用情况。

至此,我们已经设计好了内存模型,图8 展示了更新后的系统图,其中标出了存储区:

实时Java,第3 部分: 线程化和同步 ” 探讨了线程优先级的详细内容。对于我们的示例系统,设置优先级的目标如下:

  • 给予轮询线程最大优先级,从而最小化丢失度量结果的风险。
  • 避免筛选池线程被垃圾收集器中断。

为此,我们将轮询线程的线程优先级设置为38(最高的RT 优先级),将筛选池线程的优先级设置为37。由于审计线程是一个常规Java SE 线程,使用标准优先级5,因此其优先级远远低于NHRT。

这种配置意味这垃圾收集器线程的优先级略高于审计线程—— 远低于NHRT。

下载源代码 )。我们建议您阅读源代码,看看我们所讨论的理论如何实现为可运行的代码。

随同监控系的实现一起,我们还提供了一个虚拟的生产线和工人控制台,以供测试监控系统。罐子按正态分布装罐,偶尔会出现装得过多或者不满的罐子。

演示程序作为一个控制台应用程序运行,提供表明系统状况的消息。

HTTP 关于下载方法的信息

  original English text. 

  • 实时Java系列 :阅读本系列的其他部分。
  •   “ A real-time garbage collector with low overhead and consistent utilization ”(David F. Bacon,Perry Cheng å’ŒVT Rajan, Proceedings of the 30th Annual ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages ,2003年):这份报告介绍了一种动态磁盘碎片收集器,它克服了向硬RT 系统应用GC 的局限性。 
  • JSR 1: Real-time Specification for Java :您将在Java Community Process 站点中找到RTSJ。
  • “ IBM WebSphere Real Time V1.0 delivers predictable response times using Java standards ”:阅读WebSphere Real Time 的产品说明。
  • IBM WebSphere Real Time information center :访问WebSphere Real Time InfoCenter。
  • Metronome :进一步了解Metronome,整合在WebSphere Real Time 中的GC 技术。
  • IBM BladeCenter LS20 :IBM BladeCenter LS20 满足WebSphere Real Time 的硬件需求。
  • developerWorks Java 技术专区 :数百篇关于Java 编程方方面面的文章。
  • 获得产品和技术

    • WebSphere Real Time :WebSphere Real Time 使应用程序依托于精确的响应时间,利用标准Java 技术,而未牺牲确定性。

    • 实时Java 技术 :访问IBM alphaWorks 上的实时Java 技术搜索站点,查找TuningFork å’ŒRT Java 的其他先进技术。

      Discuss 

    • 通过参与developerWorks blog加入developerWorks 社区 。

    作者简介

    Caroline Gough

    在加入IBM Hursley Laboratory 的Java Technology Centre System Test 团队之前,Caroline Gough 曾在一家小软件作坊做了三年的开发人员。她现在是高级测试师,擅长压力测试和RAS(可靠性、可用性和可服务性)工具使用。她参与了IBM WebSphere Real Time V1.0 的工作,现正准备测试Java 平台的未来发布版。

    Andrew Hall

    Andrew Hall 于2004 年加入IBM 的Java Technology Centre,在此之前,他在Southampton 大学学习电子学与人工智能。 Andrew 在Java System Test 小组工作了两年,主要关注测试自动化和负载测试Java 运行时—— 包括WebSphere Real Time V1.0,如今是Java 5.0 Service Team 的一名成员。在业余时间,他喜欢读书、摄影和魔术。

    Helen Masters

    Helen Masters 1995 年毕业于Nottingham 大学,1996 年加入IBM Global Services 组织,参与了一个大型国防项目的软件开发。她于2000 年调入IBM 的Hursley Laboratory,在那里凭借其专业技术担任了多个领导角色。 Helen 目前负责领导进行IBM WebSphere Real Time V1.0 测试工作的团队。

    Alan Stevens

    Alan Stevens 于1988 年加入IBM Hursley Laboratory。他擅长改进IBM 产品(如CICS 和WebSphere)以及IBM Java 技术的性能、可伸缩性和确定性。他在Java 工具和在JSR 163 上表示IBM(JVMTI 定义)方面有着广泛的经验。他目前在领导IBM WebSphere Real Time Java performance 小组。

    Tags:

    Releated Java Articles

    Comments

    Leave a Reply