310 likes | 331 Views
Application of EPICS 3.14 on Linux. Beijing EPICS Seminar Tuesday, 8/21 2002 J.Odagiri. Contents. Application of Linux IOC Hardware support is not matured yet Still, Linux IOC is useful in some cases Hard real-time support Linux is not real-time OS Linux on RTOS for EPICS.
E N D
Application of EPICS 3.14 on Linux Beijing EPICS Seminar Tuesday, 8/21 2002 J.Odagiri
Contents • Application of Linux IOC • Hardware support is not matured yet • Still, Linux IOC is useful in some cases • Hard real-time support • Linux is not real-time OS • Linux on RTOS for EPICS
Application of Linux IOC • Linux IOC for • Purely soft records • Network devices • Alternative of PCAS • Graphics processing
Lots of Network Devices Linux IOC with EPICS 3.14 PLCs AIO/DIO Controllers Custom Embedded Controllers Network
Never want many drivers Record Support FA-M3 MELSEC CVM1 … Device Support Library Network IO Driver
Network I/O driver Queue I/O task Command Notify Response Scan task Seq task CA task
Things to be considered • Some use TCP and others use UDP • Concurrent processing on the device side • Some of the latest PLCs operate with multi-tasking OS • Device driven I/O • Event Notification • Local Scanning and Reporting • …
An Alternative of PCAS Acc control Network Utility Facility Control System Lab Network Linux IOC with EPICS 3.14
“Virtual Shared Memory” Cannel Access Run-time Database Record Support Utility Facility Control System Device Support Mapped Data Table TCP/IP Client Data Server
Some Comments • Time-stamps of the records do not show the time the data were born • To avoid additional delay • TCP/IP Client calls post_event() just after it refreshes the data table • TCP/IP Client must be implemented as a member of the threads of the iocCore • The system is almost completed and expected to be in operation in a month
Beam Profile Processing Graphics Processing on Windows PC + Portable CA Run-time DB on VME IOC Network
“Multi-media” is for Linux Graphics Card with Linux driver + Graphics Packages for Linux + Device Support Linux IOC with EPICS 3.14 (CompactPCI ?)
Contents • Application of Linux IOC • Hardware support is not matured yet • Still, Linux IOC is useful in some cases • Hard real-time support • Linux is not real-time OS • Linux on RTOS for EPICS
Latency in Linux Kernel Non-preempt-able Kernel ( tens of ms ) Interrupt Disabling ( hundreds of ms ) Address Space Switching ( tens of ms )
Non-preemptive Kernel Interrupt Latency Kernel High Priority Process Low Priority Process
Interrupt Disabling unsigned long flags; save_flags(flags); cli(); /* critical section */ restore_flags(flags);
Address Space Switching x86 CR3 User Space Each Process has Kernel Space mapping RT-task RT-task Kernel Space
Solutions • Preempt-able Kernel • Developed by MontaVista people • Linux 2.6 is to adopt this technology • RTLinux • Developed by V.Yodaiken et.al. • They hold the patent on their method
Preempt-able Kernel Interrupt Latency Kernel High Priority Process Low Priority Process
Preempt-able Linux kernel • How can it be done? • Redefining SMP spin-lock to mutex for multiple processes on a single processor • Suffers from the other two obstacles • Latency: less than some ms in most of the cases
I’m listening to nice music • I may lose my mood if • the instruction register gets an instruction from a part of the kernel never covered in prior tests • the telephone starts ringing • my child starts crying
I’m taking off into the air • I may lose my life if • the instruction register gets an instruction from a part of the kernel never covered in prior tests • a private jet crosses my route • the engine starts crying
Architecture of RTLinux Process Process task task Linux scheduler Real-time scheduler
Architecture of RTLinux Linux task task task Real-time scheduler
Architecture of RTLinux User Space Process Process task task Kernel Space Linux scheduler Real-time scheduler
Architecture of RTAI Process Process task task Linux scheduler Real-time scheduler
Hard real-time mode Process Process task task Linux scheduler Real-time scheduler
Soft real-time mode Process Process task task Linux scheduler Real-time scheduler
Can be a mixture of both Process Threads task task Linux scheduler Real-time scheduler
Conclusions • Linux IOC is useful for • Network devices • An alternative of PCAS • Graphics processing in EPICS • You may be able to benefit from • Soft real-time support some time soon • Hard real-time support some unpredictable time soon … or late