毕业设计外文资料翻译-实时系统中并发编程一种新的Java线程模型_第1页
毕业设计外文资料翻译-实时系统中并发编程一种新的Java线程模型_第2页
毕业设计外文资料翻译-实时系统中并发编程一种新的Java线程模型_第3页
毕业设计外文资料翻译-实时系统中并发编程一种新的Java线程模型_第4页
毕业设计外文资料翻译-实时系统中并发编程一种新的Java线程模型_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、毕业设计外文资料翻译学 院: 专业班级: 学 号: 指导教师: 外文出处:(外文)A new Java Thread model for concurrent programming of real-time systems. 附 件:1.外文资料翻译译文; 2.外文原文 指导教师评语:该英文资料选择合理,与毕业设计论文具有一定相关度。专业术语、词汇翻译的准确度较准确,体现了学生的专业英语应用水平。翻译工作比较认真,严格按照规定,翻译材料能与原文基本一致,能正确表达出原文意思,细节处理得当。翻译字、词数满足要求。翻译材料语句较为通顺,符合中文的表达习惯。翻译工作能够严格按照规定,达到考核、提高

2、学生英语应用水平的目的。签名: 年 月 日1外文资料翻译译文实时系统中并发编程一种新的Java线程模型Gerald Hilderink Jan Broenink Andr Bakkers概要:Java虚拟机(JVM)提供两人高度的平台无关性,但作为一个解释器,Java系统性能太差。新编译器技术和Java处理器将逐步完善了Java的性能,但尽管有这些发展,但Java离实时性还有一段距离。我们提出了java线程通模型(CJT),它消除了一些缺点,如Java的不确定行为,Java的监控弱点,对于实时系统和嵌入式系统还是缺乏反应性。CJT基于CSP提供通道,组合物构建体,和进程的调度。CJT的Java

3、类库,提供了Java所有的必要的类,很容易提供给有兴趣的用户。该方法的强大之处在于以自然的方式集成了其他范例,如Personal Java,Embedded Java,JavaBeans,CORBA和PVM,本文提出的观点作为JavaPP项目的部分进行的,链接 HYPERLINK http:/rt.el.utwente.nl/javapp http:/rt.el.utwente.nl/javapp。1.介绍实时系统设计是传统的经验丰富的专家领域,面临着各种自定义内核,非标多为低层次的语言和供应商特定的I / O设备接口。拟议的新Java线程模型来纠正这种情况。该方法解决了目前实时嵌入式系统的设

4、计方法中的四种严重的缺陷:安全性,性能,便携性,并缩短开发时间。安全是由复杂性和当前的编程语言和实时操作系统/内核之间的界面的不良定义损害。这些语义不能在保证系统安全的方式正式化。性能会受到影响,因为工程师必须接受由实时内核提供任何抽象层次。如果这些是过高或过低,不必要开销都会发生。由于当前的工具供应商的具体性质出现可移植性问题。实时嵌入式系统的开发时间太长,因缺乏开发工具,阻碍了桥梁设计之间和执行串行硬件的差距,表现为通信进程的集合。我们介绍使用的CSP(通信顺序进程)通道在Java中提供了一个通信导线互连过程。所需要的软件是作为一个Java类库,可以从我们的网站服务器下载( HYPERLI

5、NK http:/rt.el.utwente.nl/javapp http:/rt.el.utwente.nl/javapp)。实时系统的设计中使用Java可以理所当然地被实时系统设计师可以令人难以接受的。由于Java在这个领域存在一些缺陷。Java的主要弱点在于,动态存储器管理,线程模型,以及缺乏即时响应性或reactiveness到其环境的。这已被总结在以下三点。1. Java的含有可能危害进程的最后期限几个动态组件。在Java中,克隆的概念(可克隆和序列化对象)需要动态分配内存,并且依赖于垃圾收集。其他部件,如类加载器和网络类也使用动态存储器管理。确定性的行为是用于开发软件的实时和嵌入式

6、系统最重要的。一般情况下,使用不带垃圾收集静态内存分配。逃避垃圾收集器是硬几组确定性垃圾收集工作。2.Java的监视器(synchronized-wait-notify)的理念是正确的,但是在加入特定时间限制时会发生活锁,最坏的情况还会发生死锁。根据Welch,使用Java监视器是很危险的。在当前Java监视器的实现是一个单一的同步队列的末尾排队,当许多线程循环获取监视器,可能会发生无线饥饿和活锁。正确的实现必须由一个实时操作系统(RTOS)提供。3. 一个实时调度器,为的RTOS部分的存在,并不一定是一个实时系统。实时系统也应该是对输入要有极高的反应性,如报警传感器或取样时钟的反应。 Jav

7、a没有中断处理,因此,这一点必须在RTOS实现的设施。很多事情必须在操作系统级别来解决。另一方面Java是更合适的,因为它是天然成分取向。我们开发的通信Java线程类库,解决了形式化方法手段上述问题。总的概念是从数学线性代数CSP,编程语言OCCAM和晶片机得来的。这些技术包含已在实时被证明与嵌入式系统社区多年正规技术。有了这个正式的方法以及使用简洁的规则可以防止种族危害,活锁,饥饿,以及设计和实施过程中出现死锁。这个概念提供了制定一些设计模式的可能性。与使用正规的方法之一可以保证系统的行为。换句话说,形式化方法是可靠的系统的发展至关重要。我们限制利用CSP概念在上面提到的实时问题。在本文中,

8、第2节介绍了CSP通道。第3节介绍了使用的插件和游戏理念渠道的影响,第4节中描述了通道的概念和实时行为之间的关系描述,而在第5节我们的调度方法进行了探讨。在第6节总结了对使用中的实时和嵌入式系统的CSP通道。2.使用channels编程该CSP概念提供了比Java的线程模型不同的并行模型。在CSP模型定义所谓的信道,通过这些过程之间的通信进行同步处理。与长期的Java通道我们限制CSP通道,也被称为通信事件。在Java通道是由活动对象共享中间对象,线程或进程,它们相互连通。信道是单向的,最初缓冲,并完全同步。这在图1活动对象示出只能读取或通道写。当通信两个进程都准备好通信发生。流程被封锁,直到

9、通讯已准备就绪。同步,调度,和物理数据传输被封装入该通道。其结果是,程序员会从复杂的同步和调度构建体被释放图1通道模式减少了并行设计的复杂度,如数据流模型和执行之间的差距。图2表示在设计数据流,而图1中表示的实现。图2清单1是图2的代码实现1. import cjt.*;2. public class Main 3. 4. public static void main(String args) 5. 6. Channel channel = new Channel(); 7. ProcessA pa = new ProcessA(channel); 8. ProcessB pb = new

10、ProcessB(channel); 9. 10. 主要方法充当所谓的配置器,其典型地声明信道和过程一次,并随后终止。这种方法不包含共同的循环构造。相反,不太复杂的环路建设的进程。主类代表一个处理器的并发程序。这是微不足道的主类划分成几个配置器类为每个处理器。重要的是,处理将保持完好和通道具有处理器之间的媒体的知识。在清单2和3 Process A(生产过程)和Process B过程(消费过程)中给出。 ProcessA产生从零开始10000整数递增的数字。Process B过程消耗这些数字10000和它们打印到屏幕上。1. import cjt.*; 2. import java.io.IO

11、Exception; 3. public class ProcessA extends ProcessObject 4. 5. ChannelOutput channel; 6. public ProcessA(ChannelOutput out) 7. 8. channel = out; 9. start(); 10. 11. public void run() 12. 13. IntegerObject object = new IntegerObject(); 14. SeqComposition seq = new SeqComposition(); 15. try 16. 17. w

12、hile(object.value 10000) 18. 19. object.value+; 20. channel.write(seq, object); 21. 22. catch (IOException e) 23. catch (InterruptedException e) 24. 25. 1. import cjt.*; 2. import java.io.IOException; 3. public class ProcessB extends ProcessObject 4. 5. ChannelInput channel; 6. public ProcessB(Chann

13、elInput in) 7. 8. channel = in; 9. start(); 10. 11. public void run() 12. 13. IntegerObject object = new IntegerObject(); 14. SeqComposition seq = new SeqComposition(); 15. try 16. 17. while(object.value 10000) 18. 19. channel.read(seq, object); 20. System.out.println(object.value); 21. 22. catch (I

14、OException e) 23. catch (InterruptedException e) 24. 25. read()和write()方法包含两个参数序列和对象。对象序列是类类型序列组成,它表示的read()和write()方法的顺序行为。此外,还存在一个ParComposition,AltComposition,分别平行和替代行为。这些组成结构的参考手册,可以在我们的网站上找到了说明。通道是线程安全的多读者和作者。多个消费者和生产者进程可以共享相同的信道。该通道也执行不同的优先级的进程之间的调度。进程的优先级可通过通信的优先级的方式来确定。一到一对多(广播)的关系需要一个单独的设计模

15、式。3. Plug-and-PlayJava中的通道概念超越了只有沟通。核心Java开发工具包有直接的硬件支持任何框架。 Java的不支持本地语言,如C/ C +,通过JNI(Java本地接口)。将用JNI写入的更多的代码在Java少会在其他平台上的便携式。通道的概念定义,控制装置和限制硬件相关的代码只有一个地方一种抽象的方式。这种方法扩大了可重用性,可扩展性,并以面向对象的方式可维护性。在一个处理器的进程之间的通道将使用在不同的处理器的进程之间共享的存储器驱动器和信道将使用一个外围驱动。其结果是,处理将一直是硬件独立的。会有依赖于硬件与硬件无关的代码之间的明确分离如图3所示图3以避免显影每个

16、外设专用信道,一个设备驱动框架显影。设备驱动程序,我们称之为链路驱动器,是可插入到信道硬件相关对象。通道对象将处理同步和调度和链路司机将负责数据传输。通道对象是独立于硬件。其结果是,连结驱动程序将从同步和调度的任务中解放出来,因此编程链路驱动器将变得更加容易。read()和write()方法是,当由通道对象的同步机制,委托给链路驱动允许的。图4示出在一个处理器上两个进程之间的通信,而图5示出两个系统之间的通信。图4图5声明与由下面的代码所示的链接驱动一个通道:Channel chan = new Channel(new MyLinkDriver();在我们的网址http:/rt.el.utwe

17、nte.nl/javapp我们在Internet通信的示例TCP/ IP连接的驱动程序。这个例子也示出了一个单一的并发程序可以如何被分割为分布式系统。依赖于硬件的对象可以在信道的声明,即在配置器的顶层上找到。将会更加易于为程序员浏览和维护程序,在不改变的处理。再次,这个概念增加了可重用性,可扩展性和软件的可维护性。4.实时方面时间是一门现代实时系统中最关键的环节。但从需求来看,我们只关注外部定时7。用户只关心,该系统将整体以一定的时间限制内一定的刺激作出响应。不论反应是由后台任务或前台任务,它是如何相对于其他任务,内部端口到端口的时机是什么计划,什么样的行政控制来实现的需要来实现它,是不问题关

18、注系统设计师。从相同的观点,定时仅与由上下文框图所示的系统接口的信号。上下文图是在顶层由信号系统和外设或终端装置之间流动的数据流程图。在上下文图,箭头也是在那里的通信发生在指定的时间沟通渠道。这使得渠道实时系统非常重要。从上述,可以得出结论,程序员可以安全地集中于使用的信道的,而通道内部的嵌入式调度负责适当调度无需任何用户干预。因此嵌入式调度的影响被认为是下一个。5.嵌入式调度线程调度属于在并行地执行其任务应用程序的域。所以,调度器不一定是操作系统的一部分。调度器作为操作系统资源是多任务处理的所有权利,但我们可以概括这个概念。每个并发程序都可能有自己的嵌入式调度程序,调度它的并行任务。操作系统

19、可以是并发程序为好。换句话说,有可能在一个系统中运行多个调度;调度器可以调度另一个调度等。以这样的方式,不同的并行程序可以在它自己的方式进行调度。嵌入式调度通过任务切换(或上下文切换)手段削减一个线程进入多个线程。这种做法相当于面向对象的目标。单个程序是一个活动对象,即具有其自己的生命的物体,其行为内包封。并发程序包含多个活动对象,必须如期举行。因此,并发程序需要一个嵌入式调度器,它采用多线程的照顾。嵌入式调度也是一个对象,它是整个计划的一部分 - 的。有几个好处这种方法:1.在需要时一项所述的调度对象可以被包括在内。当需要相同类型的多个调度只有一个代码段驻留在内存中。 2.不同类型的调度器可

20、以使用。调度行为可以嵌套使得物流和实时策略可以混合使用。 3. Java虚拟机可被省去调度部被简化。这使得在JVM更紧凑和更便于携带。调度类可以被视为面向对象概念,因此较好维护,可扩展和可重复使用的。 4.这种方法的开放式接口允许对并行编程和调度策略等设计模式。与wait(),notify()和synchronized()方法中的一种,可根据一定的设计模式写健壮的程序。每个人都应该遵循这些模式的自由密切否则这很大程度上可能变成错误的根源。信道概念包括几个设计模式,这是彼此非常相关。这些模式处理,避免在一个更抽象的层次比处理危险同步概念僵局,饥饿和活锁。再加上嵌入式调度概念和链接驱动程序框架,我

21、们可以通过在基于信道的概念设计模式更抽象的层次处理实时约束。6.结论在实时系统设计中使用的CSP的通道提供了清除从复杂的和不必要的编程任务诸如线程编程和调度编程的统一框架。该方法允许死锁和饥饿检查。优先级的概念,应考虑通信的进程之间的属性而不是其本身的进程。由此产生的程序易于阅读和维护。生成的代码是一样快或等同精心编写Java代码一样慢。从过去的经验得知,CSP通道可以设计以迅雷不及掩耳之势。有足够的空间供性能改进,这一点应在平行于该活动进行使Java更适合于在一般的实时编程。在Java通道引进不需要的垃圾收集2.外文原文A new Java Thread model for concurre

22、nt programming of real-time systems.Gerald Hilderink Jan Broenink Andr Bakkers (G.H.Hilderink, J.F.Broenink, A.W.P.Bakkers)el.utwente.nl University of Twente, dept. EE, Control Laboratory, P.O.Box 217, 7500 AE Enschede, The NetherlandsAbstract. The Java Virtual Machine (JVM) provides a high degree o

23、f platform independence, but being an interpreter, Java has a poor system performance. New compiler techniques and Java processors will gradually improve the performance of Java, but despite these developments, Java is still far from real-time. We propose the Communicating Java Threads (CJT) model,

24、which eliminates several shortcomings, such as Javas non-deterministic behavior, Javas monitor weakness, and lack of reactiveness for real-time and embedded systems. CJT is based on CSP providing channels, composition constructs, and scheduling of processes. The CJT Java class library, which provide

25、s all necessary classes on top of Java, is readily available to interested users. The main power of the method is that it integrates these features in a natural way and in no way conflicts with other paradigms, such as PersonalJava , EmbeddedJava , JavaBeans , CORBA, and PVM. All activities, reporte

26、d in this paper, are carried out as part of the JavaPP project, see HYPERLINK http:/rt.el.utwente.nl/javapp http:/rt.el.utwente.nl/javapp.1. Introduction Real-Time system design traditionally is the domain of experienced specialists, who were faced with a variety of custom kernels, non-standard and

27、mostly low-level languages and vendor specific I/O device interfaces. The proposed new Java Thread model is to remedy this situation. The proposed method addresses four serious deficiencies of current methods for the design of real-time embedded systems: security, performance, portability, and devel

28、opment time. Security is compromised by the complexity and ill-definition of the interfaces between current programming languages and realtime operating-system/kernels. These semantics cannot be formalised in ways that guarantee the safety of systems. Performance suffers because engineers have to ac

29、cept whatever levels of abstraction are provided by the real-time kernel. If these are too high or too low, unnecessary overheads are incurred. Portability problems arise because of the vendor specific nature of current tools. The development time of real-time embedded systems is hindered by the lac

30、k of development tools to bridge the gap between design, expressed as a collection of communicating processes, and implementation on serial hardware. We introduce the use of CSP (Communicating Sequential Processes) channels 3 in Java providing a communication harness to interconnect processes. The r

31、equired software is available as a Java class library and may be downloaded from our web server ( HYPERLINK http:/rt.el.utwente.nl/javapp http:/rt.el.utwente.nl/javapp). The use of Java for the design of real-time systems may rightfully be frowned upon by real-time system designers. Because of a num

32、ber of weaknesses that Java exhibits in this area The major weaknesses lie in the Javas, dynamic memory management, the threads model, and the lack of immediate responsiveness or reactiveness to its environment. This has been summarized in the following three points. 1. Java contains several dynamic

33、 components that may jeopardize the deadlines of processes. In Java, the cloning concept (clonable and serializable objects) requires dynamic memory allocation and is dependent on garbage collection. Other components, such as the class loader and the network classes also use dynamic memory managemen

34、t. Deterministic behavior is most important for developing software for real-time and embedded systems. Generally, static memory allocation without garbage collection is used. Evading the garbage collector is hard and several groups are working on deterministic garbage collectors. 2. The monitor con

35、cept in Java (synchronized-wait-notify) works statistically correct, but the risk of starvation and livelock, or in the worst case deadlock, may occur when adding specific time constraints. According to Welch 5 the Java monitor is inefficient and dangerous to use. In the current implementation of th

36、e Java monitor, threads will queue up at the end of a single synchronized queue when the monitor has already been claimed by another thread. When many threads cyclically claim the monitor and on bad luck with timing, it may happen that a particular thread never gets off the queue. The results will b

37、e infinite starvation and livelock 5. A correct implementation must be provided by a real-time operating system (RTOS). 3. The presence of a real-time scheduler - as part of a RTOS - doesnt necessarily make a realtime system. A real-time system should also be reactive on incoming stimuli, such as an

38、 alarm sensor or a sample clock. Java has no facilities for interrupt handling, therefore, this must be implemented in the RTOS. A lot of things must be solved at operating system level. Java on the other hand is more suitable in that it is naturally component oriented. The Communicating Java Thread

39、s class library 1 we have developed, solves the above mentioned problems by means of formal methods. The total concept 2 is derived from the mathematical process algebra CSP 3, programming language occam 4, and the transputer. These technologies contain formal techniques that have been proven in the

40、 real-time and embedded system community for many years. With this formal approach and the use of concise rules one can prevent race-hazards, livelock, starvation, and deadlock during design and implementation. The concept offers the possibility to develop a number of design patterns. With the use o

41、f formal methods one can guarantee the behavior of the system. In other words, formal methods are essential to the development of reliable systems. We restrict ourselves to utilize the CSP concept at the above mentioned real-time problems. In this paper, in section 2 the CSP channels are introduced.

42、 The impact of the use of channels on the plug-and-play concept is described in section 3. In section 4 the relation between the channel concept and real-time behavior is described, while in section 5 our scheduler methods are discussed. In section 6 conclusions are given towards the use of CSP chan

43、nels in real-time and embedded systems.2. Programming with channels The CSP concept offers a different parallel model than the Java Thread model. The CSP model defines so-called channels that synchronize processes through communication between these processes. With the term Java channels we restrict

44、 ourselves to CSP channels - also called communication events. The Java channels are intermediate objects shared by active objects - threads or processes - in which they communicate with each other. Channels are one-way, initially unbuffered, and fully synchronized. This is illustrated in figure 1.

45、Active objects can only read or write on channels. Communication occurs when both processes are ready to communicate. Processes get blocked until communication is ready. Synchronization, scheduling, and the physical data transfer are encapsulated into the channel. The result is that the programmer w

46、ill be freed from complicated synchronization and scheduling constructsFiguur 1. Object oriented channel communication. The channel model reduces the gap between concurrent design models, such as data-flow models, and the implementation. Figure 2 represents a data-flow at design level, whereas figur

47、e 1 represents the implementation.Figuur 2. Dataflow or process oriented.In data-flow diagrams, an arrow corresponds to a channel and a circle represents a process. The mapping of a dataflow diagram to code is straightforward; the one-way directed arrows represent the input/output interfaces of the

48、circles whereas input or output channels define the interfaces of the processes.Listing 1 illustrates this by mapping the design of figure 2 into code. 1. import cjt.*;2. public class Main 3. 4. public static void main(String args) 5. 6. Channel channel = new Channel(); 7. ProcessA pa = new ProcessA

49、(channel); 8. ProcessB pb = new ProcessB(channel); 9. 10. Listing 1. Main programThe main() method acts as a so called configurer, which typically declares channels and processes once and subsequently terminates. This method does not contain a common loop construct. Instead, less complex loops are b

50、uild in the processes. The Main class represents a concurrent program for one processor. It is trivial to split up the Main class into several configurer classes for each processor. Important is that the processes will stay intact and channels possess the knowledge of the media between the processor

51、s (see section 3). In listings 2 and 3 ProcessA (producer process) and ProcessB (consumer process) are given. ProcessA produces 10000 integer incrementing numbers starting from zero. ProcessB consumes these 10000 numbers and prints them onto the screen. 1. import cjt.*; 2. import java.io.IOException

52、; 3. public class ProcessA extends ProcessObject 4. 5. ChannelOutput channel; 6. public ProcessA(ChannelOutput out) 7. 8. channel = out; 9. start(); 10. 11. public void run() 12. 13. IntegerObject object = new IntegerObject(); 14. SeqComposition seq = new SeqComposition(); 15. try 16. 17. while(obje

53、ct.value 10000) 18. 19. object.value+; 20. channel.write(seq, object); 21. 22. catch (IOException e) 23. catch (InterruptedException e) 24. 25. Listing 2. Producer ProcessA.1. import cjt.*; 2. import java.io.IOException; 3. public class ProcessB extends ProcessObject 4. 5. ChannelInput channel; 6. p

54、ublic ProcessB(ChannelInput in) 7. 8. channel = in; 9. start(); 10. 11. public void run() 12. 13. IntegerObject object = new IntegerObject(); 14. SeqComposition seq = new SeqComposition(); 15. try 16. 17. while(object.value 10000) 18. 19. channel.read(seq, object); 20. System.out.println(object.valu

55、e); 21. 22. catch (IOException e) 23. catch (InterruptedException e) 24. 25. Listing 3. Consumer ProcessB.The read() en write() methods contain two arguments seq and object. The object seq is of class type SeqComposition, which indicates sequential behavior of the read() and write() methods. There a

56、lso exists a ParComposition en AltComposition for respectively parallel and alternative behavior. These composition constructs are described in the reference manual, which can be found at our Web site. Channels are thread-safe for multiple readers and writers. Multiple consumer and producer processe

57、s may share the same channel. The channel also performs scheduling between processes of different priority. The priority of process can be determined by means of the priority of communication. Naturally, one-to-one and many-to-one relations can be realized. A one-to-many (broadcasting) relation need

58、s a separate design pattern. 3. Plug-and-Play The channel concept in Java goes beyond communication only. The core Java development kit has no framework for direct hardware support. Java does support native languages, such as C/C+, through the JNI (Java Native Interface). The more code that will be

59、written with JNI the less Java will be portable on other platforms. The channel concept defines an abstract way to control devices and confine hardware dependent code to one place only. This approach enlarges the reusability, extensibility, and maintainability in an object oriented manner. Channels

60、between processes on one processor will use a shared memory driver and channels between processes on different processors will use a peripheral driver. The result is that processes will always be hardware independent. There will be a clear separation between hardware dependent and hardware independe

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论