Real-Time Applications with RTLinux
.
.
.
#include <rtlinux_signal.h>
#define IRQ 7
void my_handler(int);
struct rtlinux_sigaction sig, oldsig;
float old_time=0.0;
float new_time=0.0;
float omega=10.0;
/* spin speed */
int main(void)
{
old_time = <sampleclock>;
/* capture IRQ 7 and execute my_handler
each time that IRQ 7 arrives: */
sig.sa_handler = my_handler;
sig.sa_flags = RTLINUX_SA_PERIODIC;
rtlinux_sigaction( irq, & sig, & oldsig )
/* the main part of our program: we wish to
plot information as long as the rotor is
still spinning */
while(omega>1.0){
sleep(1);
printf("Omega = %.1f\n",omega);
/* to stdout */
plot(old_time,omega);
/* via fancy plotting package*/
}
/* We are no longer spinning,
let's clean up after ourselves... */
/* free the irq: */
sig.sa_handler = RTLINUX_SIG_IGN;
rtlinux_sigaction( IRQ, & sig, & oldsig );
/* exit gracefully */
return 0;
}
void my_handler(int argument)
{
/* calculate spin speed here */
new_time= <sampleclock>;
omega = 1.0/(new_time - old_time);
old_time = new_time;
}
Function
rtlinux_sigaction(), identifies the function my_handler() as the function that we wish to execute each time that IRQ 7 is triggered. Note that ``RTLINUX_SA_PERIODIC'' tells rtlinux_sigaction() to reset itself and wait for the next signal over and over again--otherwise the signal handler would be executed exactly once. Then the while() loop in our program both prints out and plots the latest spin speed. Finally, when the spin speed drops to below 1Hz, the program begins the shutdown process, which involves the deregistering my_handler() as our signal handler.
The job of my_handler() is straightforward: calculate the spin speed. The accuracy of this calculation should be quite high because each time that IRQ 7 is triggered, the handler is called as quickly as the underlying hardware allows.
Regardless of which scheme we use to implement Task 2, the most important thing to note is the amazing versatility and elegance that the RTLinux programming environment provides.
The design compromises that make Linux such a powerful general-purpose OS render it less than ideal for hard and even soft real-time applications. By decoupling real-time and non-real-time processes, RTLinux harnesses the best of both worlds: on the one hand, it offers a high-performance, strictly deterministic real-time application environment, while on the other, it offers the rich programming environment, large application and user base, and powerful networking power of Linux. Most importantly, all improvements made to Linux by its huge development community become instantly available to RTLinux users.
RTLinux is open-source software distributed under the GPL. Further information is available at the FSMLabs web site (http://www.fsmlabs.com/downloads.html) and the software is freely available for download from the FSMLabs ftp server (ftp://ftp.fsmlabs.com/pub/rtlinux/v3/). There are working versions for x86 (uni-processor and SMP), Alpha, PowerPC (uni-processor only), and PC-104 (via miniRTL). Both source and RPM packages are available.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- RSS Feeds
- New Products
- Trying to Tame the Tablet
- What's the tweeting protocol?
- Dart: a New Web Programming Experience



1 hour 25 min ago
6 hours 4 min ago
8 hours 26 min ago
1 day 1 hour ago
1 day 3 hours ago
1 day 5 hours ago
1 day 5 hours ago
1 day 6 hours ago
1 day 10 hours ago
1 day 11 hours ago