Efficient and lightweight threading helps improve Linux real-time performance

Introduction: Recently, developers have been working on Linux user space solutions for multi-core devices that allow direct access to the underlying hardware from user space, thereby avoiding the extra system of introducing Linux kernels into user space applications. Overhead. These user space extensions (multiple) have been first driven by telecom/network high performance IP packet processing systems to enable so-called "bare metal" implementations. Among them, the Linux user space application in multi-core devices can simulate the execution process of the "no operating system" solution, that is, a simple "run to completion" and polling loop on each core for packet processing. While this goal is fundamentally achieved, the solution can still be used for very specific use cases. Are there other use cases that need to improve performance that cannot be completely solved by the above solution? If so, please list whether you can apply better Linux real-time improvements? The answer is yes, use Linux user space light thread (light- Weight threading, LWT). Let's take a look at real-time Linux and how lightweight threads can be a solution for some applications. The focus of the research is influenced by telecommunications, networking or common communications applications, and Enea focuses on the technologies used in these applications. But in general, the focus on lightweight threads will benefit many parties.

Real-time Linux and its problems

Over the past 10 years, Linux has made significant advances in real-time performance and behavior to meet the needs of a large number of applications. The details are summarized as follows:

PREEMPT_RT

PREEMPT_RT is perhaps the most notable achievement of Linux real-time extensions. The PREEMPT_RT packet solves the particularly thorny problem in multi-core Linux, the "interruption delay" problem. Before the event/data is transferred to the real user space application, the overhead of handling interrupts in the Linux kernel is very high - the overhead of the system tends to delay other interrupts, thereby increasing the processing of the interrupt information received by the receiver when the interrupt occurs. Overall delay. Similarly, there are many so-called "important parts" in the Linux kernel where interrupts can be disabled by spin locks. The overall outage latency of the standard Linux kernel does not match the most important interrupt latency requirements of many real-time applications, especially the radio access network (mobile) and mobile core infrastructure, both of which require the worst case interrupt latency to be 20- Within 30 microseconds. This also applies to many other market applications. In the fast "nutshell" PREEMPT_RT, this problem is solved in the following way:

• Pass all device driver interrupt handlers to the schedulable thread, which minimizes the processing of interrupts by the Linux kernel, so new interrupts can be processed without waiting for the previous interrupt to complete. After that, the interrupt processing becomes driven by the priority, and the interrupt processing with the highest priority is completed first according to the user's needs.

• Pass all dead space spin locks in the Linux kernel to the mutex, allowing other kernel threads to run in place of the kernel space spin lock.

Basically, PREEMPT_RT has successfully shortened the overall interrupt latency based on very high performance real-time standards, which is very helpful for a large number of Linux applications. Want to know the specific application? Please read on.

User space Linux tuning

As mentioned above, in recent years, developers have invested a lot of energy in Linux user space applications. The goal is to avoid user space applications (Linux users put a lot of effort into their added value) to take up the overhead of the Linux kernel itself to handle certain device/interrupt interactions. The model used by Linux greatly prevents user space applications from being affected by the kernel, in which all user space operations (including threads) are always mapped to the Linux kernel to handle their I/O requests. This way Linux has powerful behavior and features. However, for applications with very high data processing performance, even with PREEMPT_RT, Linux will have short-term failures because Linux kernel context switching is always required to access the hardware directly. The user-space Linux implementation allows applications to directly access hardware and interrupts without involving the Linux kernel, and can greatly improve performance. However, this performance improvement can only be achieved in an environment with extremely high I/O density. Most Linux user space adjustments focus on single-threaded applications (such as high-performance packet processing), where only one thread under Linux is used to simulate "no operating system" performance in multi-core devices.

Multithreading problem

What is missing from the real-time Linux solution survey is to carefully check the effectiveness of multithreading in real-time embedded applications. In fact, before the advent of Linux in the 1980s, people proposed an embedded real-time operating system (RTOS) to achieve low latency, high throughput, and real-time applications. The structure of the operating system has changed, but the need for this has not changed. The various performance, behavior, and features of such RTOS solutions have been tried by Linux for more than a decade. This does not mean that you tend to revert to using the RTOS, but to achieve the functionality of the RTOS. In terms of portability, the broad ecosystem of applications, and device support and general support, the overall value of Linux in real-time embedded solutions is unmatched by any RTOS. There are two practical problems:

● Why is multithreading important?

• If multithreading is important, how do we add RTOS multithreading performance, behavior, and features to Linux for greater success? The key issue is to understand Linux multithreading implementations and RTOS, and then consider what improvements can be made.

Why is multithreading important?

More than 30 years ago, when computer solution software designers encountered complex problems that could not be solved with single-threaded solutions, the need for multi-thread real-time was raised. The required solution requires a single application to have multiple tasks, perhaps some are computational tasks, some are I/O-driven tasks, but all tasks are closely related to the overall execution of the task. But the close correlation of multiple tasks means that these tasks should share a portion of the CPU time to achieve an effective overall utilization of the CPU. In many such applications, certain operations must be prohibited, waiting for certain I/O events, or other communications from another application. So there are simple executables that can handle multiple threads while disabling threads and allowing low-latency communication between threads.

Not all real-time applications need to support important multi-threading capabilities. This article does not classify related applications. But it is clear that applications that require multithreading are those that require a "waiting state" in the protocol, that is, waiting for a response or event that allows the application to continue. After that, the application should give up control of the CPU and allow other similar threads to be run instead of the response or event.

Perhaps the above tutorial is very simple for many people. Note that many mobile infrastructure and core network equipment vendors have concluded that while Linux is the preferred choice for current or future systems, the current build of Linux is not sufficient to meet all of the industry's requirements. what is the reason?

Electronic Fireproof Safes 


Safes that can resist fire for 0.5 hour.

Details:

Special fireproof material stuffing which resist damage;

Seamless molding case;

Heavy duty style doors and hinges;

 Anti-drilling, anti-burglar and anti-force;

Yongfa patent: dual system protection;

Fire proof for 1 hour and it can ensure an inner temperature to be less than 177°C(350°F), while exposed to 927°C(1700°F) flames;

Strong hinges and door-bolts;



0.5 Hour Fireproof Safe

0.5 Hour Fireproof Safe,Mechanical Fireproof Safes,Electronic Fireproof Safe,Fireproof Ammo Safes,Fireproof Safes

YONGFA INTELLIGENT TECHNOLOGY SECURITY CO., LTD. , http://www.yongfa-safe.com