Explore chapters and articles related to this topic
Inter-Task Synchronization and Communication (IPC) Based on Shared Memory
Published in Gedare Bloom, Joel Sherrill, Tingting Hu, Ivan Cibrario Bertolotti, Real-Time Systems Development with RTEMS and Multicore Processors, 2020
Gedare Bloom, Joel Sherrill, Tingting Hu, Ivan Cibrario Bertolotti
With respect to the correct solution shown in Figure 7.6, the only difference is that we swapped the two primitives shown in boldface. After all, the code still makes sense by intuition, because we could justify the placement of the primitives in the following way: Before storing a new data item into the circular buffer a producer must make sure that it has exclusive access to the circular buffer itself. Hence, it must execute a and possibly block if other tasks are operating on the buffer at the moment.Moreover, the producer must also ensure that there is some free space in the buffer before writing into it. To do this, it must execute a to update the count of free buffer elements held in and, if necessary, block until at least one free element becomes available for use.The producer can actually operate on the buffer only after both prerequisites (mutual exclusion and free space availability) have been satisfied.
Control Theory and Digital Signal Processing Primer
Published in Ivan Cibrario Bertolotti, Gabriele Manduchi, Real-Time Embedded Systems, 2017
Ivan Cibrario Bertolotti, Gabriele Manduchi
We recognize that, in the general case, the implementation of a low-pass filter (and more in general of the discrete time implementation of a linear system) consists of a linear combination of the current input, its past samples and the past samples of the output. It is therefore necessary to keep in memory the past samples of the input and output. A common technique that is used in order to avoid unnecessary copies in memory and therefore minimize the execution time of digital filters is the usage of circular buffers. A circular buffer is a data structure that maintains the recent history of the input or output. When new samples arrive, instead of moving all the previous samples in the buffer array, the pointer to the head of the buffer is advanced instead. Then, when the head pointer reaches one end of the history array, it is moved to the other end: If the array is large enough to contain the required history the samples on the other end of the array are no more useful and can be discarded. Below is the C code of a general filter implementation. Routine will build the required data structure and will return a pointer to be used in the subsequent call to routine . No memory allocation is performed by routine , which basically performs a fixed number of sums, multiplications and memory access. In fact, this routine is to be called run time, and for this reason it is important that the amount of time required for the filter computation is bounded. Conversely, routine has to be called during system initialization since its execution time may be not predictable due to the calls to system routines for the dynamic memory allocation. An alternative implementation would have used statically allocated buffers and coefficient array, but would have been less flexible. In fact, the presented implementation allows the run-time implementation of a number of independent filters.
Development of Real-Time Software for Thomson Scattering Analysis at NSTX-U
Published in Fusion Science and Technology, 2019
Roman Rozenblat, Egemen Kolemen, Florian M. Laggner, Christopher Freeman, Greg Tchilinguirian, Paul Sichta, Gretchen Zimmer
The C++11 unordered map structure maps a physical card and channel to a spatial channel and spectral channel. This map structure is filled during the program initialization by grabbing the required information from the MDSplus tree. The data structure used for storing the digitized data is a circular buffer. The advantage of this kind of data structure is that the elements are pushed and read from the top of the vector in constant time.