Presentation is loading. Please wait.

Presentation is loading. Please wait.

Synchronization between native threads and java threads for embedded real-time systems Real Time Systems Lab June 3, 2002 Jong-Koo, Lim.

Similar presentations


Presentation on theme: "Synchronization between native threads and java threads for embedded real-time systems Real Time Systems Lab June 3, 2002 Jong-Koo, Lim."— Presentation transcript:

1 Synchronization between native threads and java threads for embedded real-time systems Real Time Systems Lab June 3, 2002 Jong-Koo, Lim

2 RealTimeSystemsLab 2 Introduction  Developing embedded Real-Time Systems  C, Assembly  Difficulty of development  Not guarantee reusability of module  Java  provide convenience and highly reusability  Effective method of programming in embedded RTS  time-critical tasks ► native thread ex) sensor/motor control task  non-time critical tasks ► java thread ex) GUI - monitoring task  To Support this approach ⇒ Inter-thread communication mechanisms between native threads and Java threads are inevitably necessary ⇒ but … absence of standard libraries  This thesis proposes, designs and implements ‘Java class API’ for IPC between native threads and java threads

3 RealTimeSystemsLab 3 Basic Concept (1/2) Native Kernel native thread Java thread Java VM  Model of native & java thread

4 RealTimeSystemsLab 4 Basic Concept (2/2)  IPC & Synchronization mechanisms  Java ⇔ Java thread  System(JVM) » synchronized block … monitorEnter/monitorExit » synchronized method … ACC_SYNCHRONIZED  User » wait/notify  Linux ⇔ Linux thread  signal, pipe, FIFO,  message queue, semaphore, shared memory …  RT-Linux ⇔ (RT-)Linux thread  RT-Signal, RT-FIFO, mbuff …

5 RealTimeSystemsLab 5 Related Research  Java classes for Win32 IPC [Tom Guinther, “Interprocess Communication with Java” Jan. 1999]  Clipboard, Dynamic Data Exchange(DDE), File Mapping, Mail Slots, Pipes, Synchronization objects(Mutex, Semaphore, Event)  Writing Java Application on Netware Using Legacy NLMs [VISHAL GOENKA, KRISHANU SEAL, “Writing Java Applications on NetWare Using Legacy NLMs”, Jan. 1999]  Synchronization between a Java thread and a native Netware thread ⇒ Netware semaphores  JTRON Project [TRON Project : www.tron.org]  Java + TRON(The Real-time Operating system Nucleus) (Network Loadable Modules)

6 RealTimeSystemsLab 6 Proposed Software Architecture Hardware Java threadsLinux threads RTLinux threads Linux Kernel Java Native Interface Direct Hardware Access I/O Software interrupts Hardware interrupts Java virtual machine IPC Object RT-Linux Kernel RT-FIFO

7 RealTimeSystemsLab 7 Sequence Diagram of message passing from java thread to native thread Java threadIPC ObjectJNINative threadJVM Object.Create(arg) new JavaIPC(); Pass argument Create native IPC object Return ID of IPC Object Object.Operate(arg) Pass argument Access native IPC object Return ID of IPC Object Remove native IPC object Create native IPC object Access native IPC object Convert argument

8 RealTimeSystemsLab 8 Implemented Java IPC(Sync) Class Linux Kernel RTLinux Kernel Java application message Queue class semaphore class shared memory class RT-FIFO class Java IPC(Sync) class message Queue semaphore shared memory RT-FIFO Native application Native kernel

9 semaphore class shared memory class RT-FIFO class public class JavaMsgQ { public native int Create (int key, int msgflg); public native int Send (int msqid, MsgBuf mbuf, int msgsz, int msgflg); public native int Recv (int msqid, MsgBuf mbuf, int msgsz, int msgtyp, int msgflg); public native int Ctrl (int msqid, int cmd, MsgQid buf); } message Queue class public class JavaSema { public native int Create (int key, int nsems, int semflg); public native int Operate (int semid, SemBuf mbuf, int nsops); public native int Ctrl (int semid, int semnum, int cmd, Semun arg); } public class JavaShm { public native int Create (int key, int size, int shmflg); public native int Attach (int shmid, ShmAddr sAddr, int shmflg); public native int Detach (int shmid, ShmAddr sAddr); public native int Ctrl (int shmid, int cmd, ShmID buf); } public class JavaFIFO { public native int jaf_create (String fileName, int flag); public native int jaf_get (int rfd, String rBuf, int rSize); public native int jaf_put (int wfd, String wBuf, int wSsize); public native int jaf_destroy (int cfd); } Linux Kernel RT-Linux Kernel 9 RealTimeSystemsLab

10 10 Experimental Environment  Processor(CPU)  Intel-i586  Operating System  Linux 2.2.18  RT-Linux 3.0  Java Virtual Machine  Kaffe-VM 1.0.5

11 RealTimeSystemsLab 11 Performance Evaluation native_producer1 java_producer2 native_consumer1 native_consumer2 … … Send(Write)Recv(Read) Message Queue Result of message latency measurement using System-V ‘Message Queue’ Bounded buffer Problem java - native native - native 1 Mean Value(N=100) 234 18.78418.54318.60418.506 27312728 18.609 [ms] 28.250 [ms] Mean Value(N=1) 186.09 [us] 282.50 [us]

12 RealTimeSystemsLab 12 Conclusion  Effective method of programming in embedded RTS  time-critical tasks ► native thread  non-time critical tasks ► java thread  This thesis proposed, designed and implemented ‘Java class API’ for IPC between native threads and java threads  Further study ⇒ IPC mechanism with ‘socket’ or ‘RMI (Remote Method Invocation)’ for supporting the distributed Synchronization between native threads and Java threads.


Download ppt "Synchronization between native threads and java threads for embedded real-time systems Real Time Systems Lab June 3, 2002 Jong-Koo, Lim."

Similar presentations


Ads by Google