|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Linux Programming (3) 2.6 kernel, and compatibility with other Posix In the beginning I thought, I just turn to Linux just three days, I entered Linux purpose of the background is also very clear : We are currently using a network module bottom of the packaging is IOCP. First of all, I need this 移植到LINUX IOCP module, supported by the kernel LINUX2.6 EPOLL and SPED model used to replace the original and also to maximize compatibility module adapter.
We are developing the server system, the server process more stringent performance requirements, select the traditional, pre-poll derivation process or network server, etc. Basically, we do not consider the model development process. E-donkey from the home page that they run in the EPOLL and SPED model 4G memory Linux, the biggest user support over the 280K, seen EPOLL and SPED power, and basically we can conclude that the use of SMP servers. The data show that Linux kernel 2.6 in at least the following three aspects of the development of large-capacity high-performance server program with the help of a major (perhaps my ignorant, I am only concerned with three improvement).
1:NPTL
UNIX is not the traditional thread, the thread is subsequently joined, *nix operating system has the support of the thread is not very good. Later, IBM and Covert a thread model improvement plan that is the NGPT IBM, which is a n : m thread model, the NPTL Covert, it is a 1:1 threading model, one kernel thread a corresponding thread users. From test results, NPTL performance significantly exceeded the NPTL, IBM now has stopped NGPT development, doing maintenance. NPTL has formally joined LINUX2.6 kernel. NPTL performance on the test, please refer to : http://www-900.ibm.com/developerWorks/cn/linux/l-nptl/index.shtml short, the traditional performance linuxthreads enhanced.
2 : The new kernel scheduler
As I said, sure e-donkey spent SMP server and the Linux scheduler previously not performed very well on multiprocessor support Ingo Molnar conducted to improve, the following is quoted from the Internet :
The new version 2.6 of the Linux kernel scheduler by Ingo Molnar developed using the new scheduling algorithm, called the O (1) algorithms, it is carried out under extremely high load on the outstanding
And when there are many processors also can be used to expand.
SMP efficiency : If there is need to complete the work, all processors will work.
Process : the process need not wait long to wait processor; Meanwhile, the process will not needlessly use up a lot of CPU time.
SMP only mapped to a process of mapping process : CPU and the CPU will jump between.
The priority task is not important priority : low (and vice versa).
Load Balancing : processor scheduling will be used to reduce those excess of the load capacity of the priority process.
Performance : The new scheduler world, even in a very high case load, the system spent much time to respond to the mouse click or keyboard input will not happen again.
Processor support for high-performance network server program, SMP is necessary, the new scheduling for this benefit.
3, EPOLL and SPED
In 2.4 kernel, the generator is only as a patch release, the 2.6 kernel, the kernel development has been formally income support trees, according to information provided by the author and the generator of e-donkey server program using this model, this model might alarming. basically in line with the KQUEUE FreeBSD and Windows IOCP.
POSIX compatibility
In the new 2.6 kernel, I encountered a strange problem and we will not be able to use the POSIX Message Queue, it's clear already include "mqueue.h>;
However, the compiler is not mq_open and mq_unlink these things. Later in the overseas sites to find information on the original message queue has been removed from the traditional linuxthreads which will be added to NPTL, the current core support before, but in http://www.kernel.org -mm has issued a patch. The patch is said to solve the problem.
I write procedure, I try to use the POSIX standard for a compatibility, and then to efficiency. While the volume of these are based on the Message Queue SYSTEM V signal and the realization, but the SYSTEM V is joined in the early 1980s. A lot of things from now on, not only the use of trouble and inefficiency, such as signal SYSTEM V kernel is based on the signal, but the signal is based on the POSIX memory, the latter procedure is less in between the kernel and user mode switching, high efficiency, but it is also very simple. Windows and no basic difference between the amount of signals. SYSTEM V and POSIX standards of the majority over to the new much, because I used to support POSIX standards can be achieved.
Finally, if the system is to check our support NPTL can see in the following manner :
$ /lib/tls/libc.so.6
GNU C Library 20041006 release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6).
Compiled on a Linux 2.6.8 system on 2004-10-15.
Available extensions :
GNU libio by Per Bothner
Crypt add-on version 2.1 by Michael Glad and others
Native POSIX Threads Library by Ulrich Drepper et al.
The C stubs add-on version 2.1.2.
BIND-8.2.3-T5B
NIS (YP) /NIS+ NSS modules 0.19 by Thorsten Kukuk
Glibc-2.0 compatibility add-on by Cristian Gafton
GNU Libidn by Simon Josefsson
Thread-local storage support included.
For bugs reporting instructions, please see:<http://www.gnu.org/software/libc/bugs.html>;.
That is the red lines, if we look at the traditional linuxthreads
$ /lib/libc.so.6
GNU C Library 20041006 release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6).
Compiled on a Linux 2.6.8 system on 2004-10-15.
Available extensions :
GNU libio by Per Bothner
Crypt add-on version 2.1 by Michael Glad and others
Linuxthreads-0.10 by Xavier Leroy
The C stubs add-on version 2.1.2.
BIND-8.2.3-T5B
NIS (YP) /NIS+ NSS modules 0.19 by Thorsten Kukuk
Glibc-2.0 compatibility add-on by Cristian Gafton
GNU Libidn by Simon Josefsson
Libthread_db work sponsored by Alpha Processor Inc.
Thread-local storage support included.
For bugs reporting instructions, please see :
"Http://www.gnu.org/software/libc/bugs.html>;.
How to use the time to examine their own procedures NPTL is very simple, such as our translation of a certain executable files sem
Importation of the following orders
$ Ldd sem
Libpthread.so.0 =>; /lib/tls/libpthread.so.0 (0x4003d000)
Libc.so.6 =>; /lib/tls/libc.so.6 (0x42000000)
Libm.so.6 =>; /lib/tls/libm.so.6 (0x4004a000)
NPTL needs because TLS support, the reservoir is connected to the TLS, and if there is no link to the Secretary TLS, no procedures used NPTL.
The author Blog:http://blog.csdn.net/elssann/ |
| |