Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Thoughts on user State Protocol Stack

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I have always thought that the operating system kernel is a high-end thing, but in fact, user-mode applications are!

In a technology exchange last week, a network acceleration card manufacturer claimed that their protocol stack was a user-mode protocol stack to improve performance. I was directly deflated by its products. However, after the meeting, I looked up the relevant information and found an article called "the Secret of millions of concurrency-the Kernel is the Root of the problem" http://www.oschina.net/translate/the-secret-to-10-million-concurrent-connections-the-kernel. Write my heart, originally I have always thought so, but always dare not admit it, why do not dare to admit, it is because I love the kernel. I was discouraged by that manufacturer and expressed my deep hypocrisy and internal division!

The article says, "We are learning Unix rather than network programming", giving a correct evaluation of the book "Unix Network programming", telling us that we are dragged down by the platform, and we have been faced with the technology of how the interface of the operating system is used, rather than real programming, real unimaginable programming. When one application programming framework or middleware after another is proposed, it is said that "how can we handle our own business logic carefully without paying attention to the implementation details?" this article can make people understand the good intention of this sentence.

Historically, network programming is first UNIX, then TCP/IP and BSD socket, of course, you have to plug network programming into UNIX. Once upon a time, until now, people will laugh at people who do network programming if they don't understand UNIX. Of course, Linux has replaced UNIX in some sense. UNIX's philosophy includes the truth of the separation of mechanism and strategy, and before it was mapped to this creed, it was the motto of the separation of data and control, which is now submerged in network devices, such as routers, whose data and control planes are combined, and when the maxim awakens its followers again, SDN appears. It is a misunderstanding of the concept of UNIX, which causes network devices to combine the control plane with the data plane rather than interests, and this misunderstanding even affects the UNIX itself. You should know that the concept of UNIX affects the design of almost all operating systems and network devices, including Mirosoft Windows and Cisco's IOS. I call it a misunderstanding, not a betrayal, because the idea of UNIX may never have been really understood. Perhaps this is a misunderstanding of UNIX caused by a misunderstanding of the macro kernel.

The macro kernel idea of UNIX has a great influence, but its original intention is not to stuff all operations into the kernel, but only to stuff the confidential operations into the kernel to maintain the compactness and efficiency of the kernel, because the communication between modules requires cost, and the macro kernel idea does not explain coupling (but in terms of implementation mechanism, it is still modular). However, how to define what is a confidential operation, consider the following services:

Formulate a set of reasonable economic policies

Make a reasonable tax plan

Produce cotton cloth

Make a wool suit with exquisite fabric

Provide hairstyle with a value of ¥160

...

Excuse me, what are the confidential operations? For ordinary people, such as me, there is no suit and hair is cut once a year, but for aristocrats, except for the last one, everything else may be confidential. It's hard to define secret operations, so this definition makes it easy to cram everything into the UNIX. "UNIX Network programming" tells that you only need to write a small lightweight server to get UNIX to do all the complicated work. A persuasive thing can help the author of "the Secret of millions of concurrency-the Kernel is the Root of the problem" to express his deep malice, that is, Linux once implemented a WEB server in the kernel. What a joke, or a huge irony about the macro kernel. It's important to remember that UNIX doesn't ask newcomers to cram everything into the kernel, just that the kernel retains control.

We might as well change our way of thinking and go back to the original idea of UNIX. From the point of view of control, you may be able to name a lot of process scheduling, resource management, file systems. Network protocol stack. However, it seems that all of us have always regarded the network as an exception. The network IO is neither a block device IO nor a character device IO. According to the concept that everything in UNIX is a file, we cannot give the network a reasonable location. Socket interface is a complete protocol stack, not some equipment, we have to face the adjustment of network parameters, so how many shifts we have done, which is the awkward position of network IO compared with other device IO.

Is it freer to interface directly with the network card? from then on, we got rid of the shackles of the protocol stack, but we had to implement the protocol stack ourselves. I thought about this a few days ago, mainly to solve the problem of no permission to operate the network on the mobile phone. I was thinking about freedom rather than performance, and the article "Secret" was talking about performance. Review the introduction of that manufacturer. Their products carry on the protocol stack processing of the data packet in the user mode, and maximize the use of hardware acceleration functions such as the network coprocessor, which makes people sigh, excuse me, how to transfer the processing to the coprocessor using the protocol stack of the operating system kernel? The use of Netfilter is out of date! I've always wanted to use Netfilter to transfer processing to a card, but I find I'm out of date, and the answer now is to bypass the kernel protocol stack! Nowadays, there is really such a technology, one of which is called PF_RING, which is actually a packet grabbing mechanism, which fetches the packet directly from the link layer, and then you can handle it whatever you want. I just tried it, and it works well, and when combined with uIP, it's too fierce. Of course, I don't have a test environment with tens of millions of levels of concurrency. What I'm talking about is that it actually works!

Talk about performance issues. Performance has nothing to do with the kernel, you can't expect a breakthrough in performance from 32-bit Linux 2.6.8 to 64-bit Linux 2.6.32 kernel, nor do you expect to spell out the performance improvement of Linux and Windows kernels, the key lies in the application! WHY? Because performance is a high-end private service, the kernel infrastructure is not responsible for this high-definition service. Come up with high performance, in fact, a kind of artistic behavior, involving all aspects of fine-tuning, is definitely high-end atmospheric behavior, do you expect the kernel to help you do this? In the world of microkernels, this is possible, but don't turn your preference to microkernels. Why do you want the kernel to take care of everything? Why not take care of it yourself! Even if you can't handle it, put your thoughts or ideas out, someone will take care of it. No matter it is the macro kernel or the micro kernel, it is not suitable to put high-definition things into it, otherwise, for the macro kernel, it will become a ball of dung beetle and a web woven by spiders.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 229

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report