Thinking about the user-state protocol stack

Source: Internet
Author: User
I've always thought the OS kernel is a tall thing, but actually the application of user state is.
In a technical exchange last week, a network accelerator card manufacturer claimed that their stack of protocols was a user-state stack, used to improve performance, I directly to its products vent the gas, but after the meeting, I looked up the relevant information, found an article "tens of millions of concurrent secrets-the core is the root of the problem", wrote my voice, Originally I always think so, just have been afraid to admit it, why dare not admit, it is because I love the core. I was discouraged by the firm to express my deep hypocrisy, inner division.
The article says, "We're learning UNIX, not network programming." "UNIX Network Programming," a book gives the correct evaluation, told us that we are the platform, we have been faced with the interface of the operating system how to use the technology, rather than real programming, truly unconstrained imagination like programming. One more application framework or middleware, when presented, says "How can we take care of our own business logic without paying attention to the details of implementation", this article can make people understand the meaning of this sentence.
Historically looking at network programming, is the first Unix, and then have TCP/IP and BSD socket, of course, to the network programming to the inside of Unix, once upon a time, until now, do not know how to do Network programming UNIX will be ridiculed, of course, Linux in a sense has replaced Unix. The philosophy of UNIX includes the truth of mechanism and strategy separation, before it is mapped into this creed is the separation of data and control, a maxim that is now submerged in networked devices, such as routers, whose data and control surfaces are combined, and Sdn appears when The Maxim awakens its followers again. is a misunderstanding of the UNIX concept, resulting in the network device to bring the control surface and data surface together rather than benefit, this misunderstanding even affected the UNIX itself. Know that the UNIX concept affects almost all operating systems and the design of network devices, including Mirosoft windows and Cisco IOS. I say it's 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 the misunderstanding of the macro kernel.
UNIX's macro kernel thought has a big impact, but it's not meant to cram all the operations into the kernel, but only the confidential operation into the kernel, to maintain the compactness and efficiency of the core, because the communication between the modules need cost, the macro-kernel idea does not explain the coupling (but in the implementation mechanism, or modular). But how to define what is a confidential operation, consider the following services:
To formulate a set of reasonable economic policies;
Develop a set of reasonable tax plans;
Production of cotton cloth;
Make a wool suit with exquisite fabrics;
Provide a value ¥160 hairstyle;
...
Which is confidential operation. For ordinary people, such as me, there is no suit, hair once a year, but for the nobility, in addition to the last one, the other may be confidential operation ... It's hard to define a confidential operation, so this definition makes it easy to cram everything into UNIX. UNIX network programming tells you that you just need to write a small, lightweight server to get UNIX to do all the work. A persuasive thing can help the author of the "tens of millions of concurrent secrets-the kernel is the root of the problem" to express the deep malice, that is, Linux once implemented a Web server in the kernel, what a huge joke, or a huge irony of the macro kernel ... The thing to keep in mind is that UNIX does not allow the successor to cram everything into the kernel, but that the kernel retains control.
We might as well change a thought, back to the original Unix idea, from the control point of view, which is the control surface, perhaps you can say a lot of, process scheduling, resource management, file system ... Network protocol stack. However, as if all of us have been using the Internet as an exception, network IO is not a piece of device Io is not a character device Io, according to UNIX all the document concept, we can not give the network a reasonable position. Socket interface is a complete protocol stack, rather than what the device, we have to face the adjustment of network parameters, so we added a number of classes, which is the network IO and other device io in the awkward position.
Direct and Nic interface is not more free, from then on we get rid of the shackles of the protocol stack, however, we have to implement the protocol stack, the previous days I have thought about these, mainly to solve the mobile phone above the operation of the network without permission, I was thinking about a question of freedom rather than performance issues, and the "secret" It's a matter of performance that the article says, review that manufacturer's introduction, their products in the User State packet protocol stack processing, the maximum use of network coprocessor and other hardware acceleration functions, let people sigh, please, using the operating system kernel protocol stack, how to transfer processing to the coprocessor. The answer to using netfilter is outdated. I've always wanted to play. NetFilter the processing to a card, but I found out that I was obsolete, and now the answer is to bypass the kernel protocol stack directly. Today, there really is such a technology, one of which is called pf_ring, is actually a grab packet mechanism, the packet directly from the link layer to get, and then you want to do how to deal with, just try it, quite good, and uip combination, is simply too fierce. Of course, I don't have a tens concurrent test environment, I just say that it actually can work.
       talk about performance issues. Performance and kernel-independent, you do not expect to switch from 32-bit Linux 2.6.8 to 64-bit Linux 2.6.32 core performance will be a breakthrough, do not expect to spell the Linux and Windows kernel for performance improvement results, the key is the application program. WHY. Because performance is a high-end private customization service, the kernel infrastructure is not responsible for this high order service. Come up with high performance, in fact, a kind of artistic behavior, involving all aspects of fine-tuning, is absolutely high-end atmospheric grade behavior, you expect the kernel can help you do this. In the micro-core world, this is possible, but do not turn your preferences to the micro-core, why do you want the kernel to do everything. Why don't you fix it yourself? Even if you do not know how to put ideas or ideas out, there will always be someone to fix AH. Whether it is the macro kernel or micro-core, it is not appropriate to Gao Ding things into the inside, otherwise, for the macro core, it becomes a beetle rolling ball, for the micro-core, it became a spider weaving network ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.