60 likes | 309 Vues
Linux API Part 2. Dr. Michael L. Collard www.sdml.info/collard www.sdml.info/collard/linux collard@cs.kent.edu. Threading: pthreads. POSIX threads NPTL (Native Posix Thread Library) Red Hat “Won” over NGPT (Next Generation Posix Threads) RHEL 3, Linux Kernel 2.6, GNU C Library
E N D
Linux API Part 2 Dr. Michael L. Collard www.sdml.info/collard www.sdml.info/collard/linux collard@cs.kent.edu
Threading: pthreads • POSIX threads • NPTL (Native Posix Thread Library) • Red Hat • “Won” over NGPT (Next Generation Posix Threads) • RHEL 3, Linux Kernel 2.6, GNU C Library • Performance: Create 100,000 threads on IA-32 • NPTL off: 15 minutes • NPTL on: 2 seconds
Zero-Copy • Use read/write as before • Multiple copies in/out of kernel mode • mmap – memory map input file • Eliminates copy from input file • sendfile – copies data in the kernel • Limited to socket file descriptor for output
read/write read(infd, buf, len) write(outfd, buf, len) “Zero Copy I: User-Mode Perspective” by Dragan Stancevic http://www.linuxjournal.com/article/6345
mmap/write buf = mmap(infd, len) write(outfd, buf, len) “Zero Copy I: User-Mode Perspective” by Dragan Stancevic http://www.linuxjournal.com/article/6345
sendfile sendfile(infd, outfd); “Zero Copy I: User-Mode Perspective” by Dragan Stancevic http://www.linuxjournal.com/article/6345