Native POSIX Thread Library

Total Page:16

File Type:pdf, Size:1020Kb

Native POSIX Thread Library Native POSIX T hread Library - Wikipedia, the free... http://en.wikipedia.org/w/index.php?title=Native_P... Native POSIX Thread Library From Wikipedia, the free encyclopedia The Native POSIX Thread Library (NPTL) is a software feature that enables the Linux kernel to run programs written to use POSIX Threads fairly efficiently. In tests, NPTL succeeded in starting 100,000 threads on a IA-32 in two seconds. In comparison, this test under a kernel without NPTL would have taken around 15 minutes. [1][2] Contents 1 History 2 Design 3 See also 4 References 5 External links History Before the 2.6 version of the Linux kernel, processes were the schedulable entities, and there was no real support for threads. However, it did support a system call - clone() - which creates a copy of the calling process where the copy shares the address space of the caller. The LinuxThreads project used this system call to provide kernel-level thread support (most of the previous pthread implementations in Linux worked entirely in userland). Unfortunately, it had a number of issues with true POSIX compliance, particularly in the areas of signal handling, scheduling, and inter-process synchronization primitives. To improve upon LinuxThreads, it was clear that some kernel support and a re-written threads library would be required. Two competing projects were started to address the requirement: NGPT (Next Generation POSIX Threads) worked on by a team which included developers from IBM, and NPTL by developers at Red Hat. NGPT was abandoned in mid-2003, at about the same time when NPTL was released. NPTL was first released in Red Hat Linux 9. Old-style Linux POSIX threading is known for having trouble with threads that refuse to yield to the system occasionally, because it does not take the opportunity to preempt them when it 1 of 3 09/27/2009 08:01 PM Native POSIX T hread Library - Wikipedia, the free... http://en.wikipedia.org/w/index.php?title=Native_P... arises, something that Windows was known to do better at the time. Red Hat claimed that NPTL fixed this problem in an article on the Java website about Java on Red Hat Linux 9.[3] NPTL has been part of Red Hat Enterprise Linux since version 3, and in the Linux kernel since version 2.6. It is now a fully integrated part of the GNU C Library. There exists a tracing tool for NPTL, called POSIX Thread Trace Tool (http://nptltracetool.sourceforge.net/) (PTT (http://sourceforge.net/projects /nptltracetool/) ). And an Open POSIX Test Suite (http://posixtest.sourceforge.net/) (OPTS (http://sourceforge.net/projects /posixtest/) ) was written for testing the NPTL library against the POSIX standard. Design NPTL uses a similar approach to LinuxThreads, in that the primary abstraction known by the kernel is still a process, and new threads are created with the clone() system call (called from the NPTL library). However, NPTL requires specialized kernel support to implement (for example) the contended case of synchronisation primitives which might require threads to sleep and wake again. The primitive used for this is known as a futex. NPTL is a so-called 1×1 threads library, in that threads created by the user (via the pthread_create() library function) are in 1-1 correspondence with schedulable entities in the kernel (processes, in the Linux case). This is the simplest possible threading implementation. An alternative to NPTL's 1×1 model is the m×n model where there are typically more userland threads than schedulable entities. In the m×n implementation, the threading library is responsible for scheduling user threads on the available schedulable entities; this makes context switching of threads very fast, as it avoids system calls. However, this increases complexity and the likelihood of priority inversion, as well as suboptimal scheduling without extensive (and expensive) coordination between the userland scheduler and the kernel scheduler. See also LinuxThreads Library (computer science) Green threads 2 of 3 09/27/2009 08:01 PM Native POSIX T hread Library - Wikipedia, the free... http://en.wikipedia.org/w/index.php?title=Native_P... References 1. ^ Introducing the 2.6 Kernel (http://www.linuxjournal.com/article/6530) 2. ^ The Native POSIX Thread Library for Linux (http://people.redhat.com/drepper /nptl-design.pdf) 3. ^ Red Hat Linux 9 and Java 2 Platform, Standard Edition 1.4.2: A Winning Combination (http://java.sun.com/developer/technicalArticles/JavaTechandLinux /RedHat/) External links NPTL Design paper (http://people.redhat.com/drepper/nptl-design.pdf) NPTL Trace Tool (http://nptltracetool.sourceforge.net/) OpenSource tool to trace and debug multithreaded applications using the NPTL. Retrieved from "http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library" Categories: Linux kernel | POSIX standards | Threads This page was last modified on 26 June 2009 at 19:32. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. 3 of 3 09/27/2009 08:01 PM.
Recommended publications
  • Redhawk Linux User's Guide
    Linux® User’s Guide 0898004-510 May 2006 Copyright 2006 by Concurrent Computer Corporation. All rights reserved. This publication or any part thereof is intended for use with Concurrent products by Concurrent personnel, customers, and end–users. It may not be reproduced in any form without the written permission of the publisher. The information contained in this document is believed to be correct at the time of publication. It is subject to change without notice. Concurrent makes no warranties, expressed or implied, concerning the information contained in this document. To report an error or comment on a specific portion of the manual, photocopy the page in question and mark the correction or comment on the copy. Mail the copy (and any additional comments) to Concurrent Computer Corporation, 2881 Gateway Drive, Pompano Beach, Florida, 33069. Mark the envelope “Attention: Publications Department.” This publication may not be reproduced for any other reason in any form without written permission of the publisher. RedHawk, iHawk, NightStar, NightTrace, NightSim, NightProbe and NightView are trademarks of Concurrent Computer Corporation. Linux is used pursuant to a sublicense from the Linux Mark Institute. Red Hat is a registered trademark of Red Hat, Inc. POSIX is a registered trademark of the Institute of Electrical and Electronics Engineers, Inc. AMD Opteron and AMD64 are trademarks of Advanced Micro Devices, Inc. The X Window System is a trademark of The Open Group. OSF/Motif is a registered trademark of the Open Software Foundation, Inc. Ethernet is a trademark of the Xerox Corporation. NFS is a trademark of Sun Microsystems, Inc. HyperTransport is a licensed trademark of the HyperTransport Technology Consortium.
    [Show full text]
  • Porting IRIX® Applications to SGI® Altix® Platforms: SGI Propack™ for Linux®
    Porting IRIX® Applications to SGI® Altix® Platforms: SGI ProPack™ for Linux® 007-4674-001 CONTRIBUTORS WrittenbyStevenLevine Illustrated by Chrystie Danzer Production by Karen Jacobson Engineering contributions by George Pirocanac COPYRIGHT © 2004, Silicon Graphics, Inc. All rights reserved; provided portions may be copyright in third parties, as indicated elsewhere herein. No permission is granted to copy, distribute, or create derivative works from the contents of this electronic documentation in any manner, in whole or in part, without the prior written permission of Silicon Graphics, Inc. LIMITED RIGHTS LEGEND The software described in this document is “commercial computer software” provided with restricted rights (except as to included open/free source) as specified in the FAR 52.227-19 and/or the DFAR 227.7202, or successive sections. Use beyond license provisions is a violation of worldwide intellectual property laws, treaties and conventions. This document is provided with limited rights as defined in 52.227-14. TRADEMARKS AND ATTRIBUTIONS Silicon Graphics, SGI, the SGI logo, Altix, IRIX, Origin, Onyx, Onyx2, and XFS are registered trademarks and CaseVision, NUMAflex, NUMAlink, OpenMP, Performance Co-Pilot, ProDev, SGI Advanced Linux, SGI ProPack, SGIconsole, and SHMEM are trademarks of Silicon Graphics, Inc., in the United States and/or other countries worldwide. SGI Advanced Linux Environment 3.0 is based on Red Hat Enterprise Linux AS 3.0, but is not sponsored by or endorsed by Red Hat, Inc. in any way. Cray is a registered trademark of Cray, Inc. FLEXlm is a registered trademark of Macrovision Corporation. Java is a registered trademark of Sun Microsystems, Inc. in the United States and/or other countries.
    [Show full text]
  • Course Summary
    Pro Tech "Charting the Course ..." protechtraining.com Linux Internals Overview Course Summary Description The primary responsibilities of any computer operating system are to facilitate I/O between the system hardware and applications, and to manage the execution environment of the applications. Internals is the study of how an operating system accomplishes these tasks. The Linux operating system is unique because it is totally open and free. The source code is readily available and may be modified by anyone who possesses the knowledge to do so. Systems programmers must have a working knowledge of Linux internals in order to write kernel extensions such as device drivers, system calls and virtual file systems. Applications programmers will write more efficient code if they understand what takes place in the operating system when they use the kernel application programming interface (API). By understanding how the Linux kernel allocates hardware and software resources to processes and files, system administrators and support people will be better equipped to manage system performance and troubleshoot Linux. Objectives At the completion of this course, the student will be able to describe, in detail, the functionality of each of the Linux kernel subsystems. Topics • Overview of the Linux Kernel • Process Management • Linux System Calls • Linux Virtual Memory Manager • Disk-Based File Systems • Kernel File System Structures • Signals • Sockets • The Device I/O Subsystem Audience This course is designed for Linux system administrators and support people who desire a comprehensive understanding of the inner workings of the Linux kernel, applications programmers who want to know more about writing code that efficiently interfaces with the Linux kernel and systems programmers who develop kernel extension for Linux.
    [Show full text]
  • Building Embedded Linux Systems ,Roadmap.18084 Page Ii Wednesday, August 6, 2008 9:05 AM
    Building Embedded Linux Systems ,roadmap.18084 Page ii Wednesday, August 6, 2008 9:05 AM Other Linux resources from O’Reilly Related titles Designing Embedded Programming Embedded Hardware Systems Linux Device Drivers Running Linux Linux in a Nutshell Understanding the Linux Linux Network Adminis- Kernel trator’s Guide Linux Books linux.oreilly.com is a complete catalog of O’Reilly’s books on Resource Center Linux and Unix and related technologies, including sample chapters and code examples. ONLamp.com is the premier site for the open source web plat- form: Linux, Apache, MySQL, and either Perl, Python, or PHP. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit con- ferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today for free. main.title Page iii Monday, May 19, 2008 11:21 AM SECOND EDITION Building Embedded Linux SystemsTomcat ™ The Definitive Guide Karim Yaghmour, JonJason Masters, Brittain Gilad and Ben-Yossef, Ian F. Darwin and Philippe Gerum Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Building Embedded Linux Systems, Second Edition by Karim Yaghmour, Jon Masters, Gilad Ben-Yossef, and Philippe Gerum Copyright © 2008 Karim Yaghmour and Jon Masters.
    [Show full text]
  • Linux Threading Models Compared: Linuxthreads and NPTL
    Linux threading models compared: LinuxThreads and NPTL http://www-128.ibm.com/developerworks/linux/library/l-threading.html?... Linux threading models compared: LinuxThreads and NPTL A rundown of the key differences for developers who need to port Level: Intermediate Vikram Shukla ( [email protected]), Software Engineer, IBM 31 Jul 2006 The LinuxThreads project originally brought multithreading to Linux®, but LinuxThreads didn't conform to POSIX threading standards. Although the more recent Native POSIX Thread Library (NPTL) library has filled in some of the gaps, other issues remain. This article describes some of the differences between these two Linux threading models for developers who may need to port their applications from LinuxThreads to NPTL or who simply want to understand where the differences lie. When Linux was first developed, it did not have real support for threading in the kernel. But it did support processes as schedulable entities through the clone() system call. This call created a copy of the calling process, with the copy sharing the address space of the caller. The LinuxThreads project used this system call to simulate thread support entirely in user space. Unfortunately, this approach had a number of disadvantages, particularly in the areas of signal handling, scheduling, and interprocess synchronization primitives. Moreover, the threading model did not conform to POSIX requirements. To improve on LinuxThreads, it was clear that some kernel support and a rewritten threads library would be required. Two competing projects were started to address these requirements. A team including developers from IBM worked on NGPT, or Next-Generation POSIX Threads. Meanwhile, developers at Red Hat were working on the NPTL.
    [Show full text]
  • Building and Installing Glibc
    APPENDIX A Building and Installing Glibc THE GNU C LIBRARY, popularly known as Glibc, is the unseen force that makes GCC, most C language applications compiled with GCC on Linux systems, and all GNU /Linux systems themselves work. Any code library provides a set of func­ tions that simplify writing certain types of applications. In the case of the GNU C library, the applications facilitated by Glibc are any C programming language applications. The functions provided by Glibc range from functions as funda­ mental to C as printf () all the way to Portable Operating System Interface for Computer Environments (POSIX) functions for opening low-level network con­ nections (more about the latter later). Rebuilding and changing the library on which almost every GNU /Linux appli­ cation depends can be an intimidating thought. Luckily, it is not as problematic or complex as you might think. This chapter explains how to obtain, build, and install newer versions of the GNU C library, discusses problems that you might encounter, and also explains how to work around those problems in order to get your system(s) up and running with newer or alternate versions of the GNU C library that may be present by default on the system(s) that you are using. NOTE The most important requirement for upgrading Glibc on your system is having sufficient disk space to download and build the source code, back up files that you want to preserve in case you encounter upgrade problems, and install the new version ofGlibc. You should make sure that your system has approximately 200MB offree space in order to build and install Glibc.
    [Show full text]
  • Linux Embarqué 2 Édition
    11674_LinuxEmbarque2e_XP 5/09/05 13:06 Page 1 Linux e Pierre Ficheux Linux embarqué 2 édition Ingénieur des Arts et P. Ficheux Avec Linux, solution idéale pour les systèmes embarqués Métiers, Pierre Ficheux est deux études Discrets mais omniprésents, les logiciels embarqués équipent aussi bien les appareils électroménagers et les un linuxien de renom, de cas véhicules que les assistants personnels et les téléphones mobiles. Dans un contexte où robustesse, légèreté et initiateur de plusieurs sites embarqué interopérabilité sont essentielles, le système libre Linux se révèle un excellent choix : Open Source et libre de droits, Linux et auteur il peut être adapté et diffusé à grande échelle pour un coût de licence nul, tout en intégrant l’ensemble des de nombreux tutoriels. dialectes Internet et multimédias. Il a travaillé entre autres chez Red Hat et s’est e Un ouvrage de référence accompagné de deux études de cas spécialisé dans les 2 édition Sans équivalent en français, l’ouvrage de Pierre Ficheux commence par un panorama du marché de l’embarqué et applications industrielles des solutions Linux existantes en les comparant aux alternatives propriétaires. Il indique la méthodologie à suivre de Linux embarqué. pour construire, à partir du noyau Linux, un système embarqué adapté. Cette nouvelle édition traite également de Pierre Ficheux est la prise en charge du noyau 2.6 ainsi que de l’utilisation et la création de chaîne de compilation croisée (ELDK et directeur technique CROSSTOOL). Deux études de cas directement extraites de l’expérience industrielle de l’auteur décrivent la construc- d’Open Wide, société tion d’un lecteur/enregistreur CD/MP3 et d’une station de consultation Internet.
    [Show full text]
  • Linux System Programming
    www.it-ebooks.info www.it-ebooks.info SECOND EDITION Linux System Programming Robert Love www.it-ebooks.info Linux System Programming, Second Edition by Robert Love Copyright © 2013 Robert Love. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editors: Andy Oram and Maria Gulick Indexer: WordCo Indexing Services, Inc. Production Editor: Rachel Steely Cover Designer: Randy Comer Copyeditor: Amanda Kersey Interior Designer: David Futato Proofreader: Charles Roumeliotis Illustrator: Rebecca Demarest May 2013: Second Edition Revision History for the Second Edition: 2013-05-10: First release See http://oreilly.com/catalog/errata.csp?isbn=9781449339531 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Linux System Programming, Second Edition, the image of a man in a flying machine, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
    [Show full text]
  • Otimizando Servidores Web De Alta Demanda Dissertação De Mestrado
    Otimizando Servidores Web de Alta Demanda Renato Hirata Dissertação de Mestrado 1 N! p AI Instituto de Computação Universidade Estadual de Campinas Otimizando Servidores Web de Alta Demanda Renato Hirata Abril de 2002 Banca Examinadora: • Prof. Dr. Paulo Lício de Geus (Orientador) Instituto de Computação, UNICAMP • Prof. Dr. Adriano Mauro Cansian IBILCE, UNESP • Prof. Dr. Rogério Drummond Instituto de Computação, UNICAMP • Prof. Dr. Célio Cardoso Guimarães (Suplente) Instituto de Computação, UNICAMP Ia CM00171050-6 Ficha Catalográfica elaborada pela Biblioteca do IMECC da UNICAMP Hirata, Renato H613o Otimizando Servidores Web de alta demanda I Renato Hirata. -Campinas, SP: [s.n.l, 2002. Orientador: Paulo Lício de Geus. Dissertação (mestrado) - Universidade Estadual de Campinas, Instituto de Computação. 1. Redes de computação - Administração. 2. Desempenho 3. Internet (Redes de computadores). 4. Redes de computação - Protocolos. 5. UNIX (Sistema operacional de computador) - Otimização. 6. TCP/IP (Protocolos de redes de computação) 7. World Wide Web (Sistema de Recuperação de Informação). I. Geus, Paulo Lício de. li. Universidade Estadual de Campinas. Instituto de Computação. Ill. Título 11 TERMO DE APROVAÇÃO Tese defendida e aprovada em 11 de abril de 2002, pela Banca Examinadora composta pelos Professores Doutores: Prof. Dr. Adriano Mauro Cansian IBILCE - Unesp Prof. Dr. Rogério Drum IC- UNICAMP Prof. Dr. Paulo Lício deGeUS IC- UNICAMP 111 Otimizando Servidores Web de Alta Demanda Este exemplar corresponde à redação final da Dis­ sertação devidamente corrigida e defendida por Renato Hirata e aprovada pela Banca Examinadora. Campinas, 11 de Abril de 2002 d 7- Paulo Ucio de Geus (Orientador) Dissertação apresentada ao Instituto de Com­ putação, UNIC&I\I!P, como requisito parcial para a obtenção do título de Mestre em Ciência da Com­ putação.
    [Show full text]
  • Linux Performance and Tuning Guidelines
    Front cover Linux Performance and Tuning Guidelines Operating system tuning methods Performance monitoring tools Performance analysis Eduardo Ciliendo Takechika Kunimasa ibm.com/redbooks Redpaper International Technical Support Organization Linux Performance and Tuning Guidelines July 2007 REDP-4285-00 Note: Before using this information and the product it supports, read the information in “Notices” on page vii. First Edition (July 2007) This edition applies to kernel 2.6 Linux distributions. This paper was updated on April 25, 2008. © Copyright International Business Machines Corporation 2007. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Notices . vii Trademarks . viii Preface . ix How this paper is structured. ix The team that wrote this paper . .x Become a published author . xi Comments welcome. xii Chapter 1. Understanding the Linux operating system. 1 1.1 Linux process management . 2 1.1.1 What is a process? . 2 1.1.2 Life cycle of a process . 3 1.1.3 Thread. 4 1.1.4 Process priority and nice level . 5 1.1.5 Context switching . 5 1.1.6 Interrupt handling . 6 1.1.7 Process state . 6 1.1.8 Process memory segments. 8 1.1.9 Linux CPU scheduler . 9 1.2 Linux memory architecture . 10 1.2.1 Physical and virtual memory . 10 1.2.2 Virtual memory manager. 12 1.3 Linux file systems . 15 1.3.1 Virtual file system . 15 1.3.2 Journaling . 16 1.3.3 Ext2. 17 1.3.4 Ext3.
    [Show full text]
  • Table of Contents
    Building Embedded Linux Systems Author : Karim Yaghmour Publisher : O'Reilly Date Published : April 2003 ISBN : 0-596-00222-X Table of Contents Dedication Preface Audience of This Book Scope and Background Information Organization of the Material Hardware Used in This Book Software Versions Book Web Site Typographical Conventions Contact Information Acknowledgments Chapter 1. Introduction Section 1.1. Definitions Section 1.2. Real Life and Embedded Linux Systems Section 1.3. Example Multicomponent System Section 1.4. Design and Implementation Methodology Chapter 2. Basic Concepts Section 2.1. Types of Hosts Section 2.2. Types of Host/Target Development Setups Section 2.3. Types of Host/Target Debug Setups Section 2.4. Generic Architecture of an Embedded Linux System Section 2.5. System Startup Section 2.6. Types of Boot Configurations Section 2.7. System Memory Layout Chapter 3. Hardware Support Section 3.1. Processor Architectures Section 3.2. Buses and Interfaces Section 3.3. I/O Section 3.4. Storage Section 3.5. General Purpose Networking Section 3.6. Industrial Grade Networking Section 3.7. System Monitoring Chapter 4. Development Tools Section 4.1. Using a Practical Project Workspace Section 4.2. GNU Cross-Platform Development Toolchain Section 4.3. C Library Alternatives Section 4.4. Java Section 4.5. Perl Section 4.6. Python Section 4.7. Ada Section 4.8. Other Programming Languages Section 4.9. Integrated Development Environments Section 4.10. Terminal Emulators Chapter 5. Kernel Considerations Section 5.1. Selecting a Kernel Section 5.2. Configuring the Kernel Section 5.3. Compiling the Kernel Section 5.4.
    [Show full text]
  • SMP-HOWTO.Pdf
    Linux SMP HOWTO Linux SMP HOWTO Table of Contents Linux SMP HOWTO..........................................................................................................................................1 Enkh Tumenbayar, etumenba@ouray.cudenver.edu...............................................................................1 1. Licensing..............................................................................................................................................1 2. Introduction..........................................................................................................................................1 3. Questions related to any architectures.................................................................................................1 4. x86 architecture specific questions......................................................................................................1 5. Sparc architecture specific questions...................................................................................................1 6. PowerPC architecture specific questions.............................................................................................1 7. Alpha architecture specific questions..................................................................................................1 8. Useful pointers.....................................................................................................................................2 9. Glossary...............................................................................................................................................2
    [Show full text]