Internals.Pdf

Total Page:16

File Type:pdf, Size:1020Kb

Internals.Pdf Linux Internals (to the power of -1) Simone Demblon Sebastian Spitzner Linux Internals: (to the power of -1) by Simone Demblon and Sebastian Spitzner Published 2005-01-25 22:22:06 Copyright © 2004 The Shuttleworth Foundation Unless otherwise expressly stated, all original material of whatever nature created by the contributors of the Learn Linux community, is licensed under the Creative Commons [http://creativecommons.org/] license Attribution-ShareAlike 2.0 [http://creativecommons.org/licenses/by-sa/2.0/] [http://creativecommons.org/licenses/by-sa/2.0/]. What follows is a copy of the "human-readable summary" of this document. The Legal Code (full license) may be read here [http://creativecommons.org/licenses/by-sa/2.0/legalcode/]. You are free: • to copy, distribute, display, and perform the work • to make derivative works • to make commercial use of the work Under the following conditions: Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. • For any reuse or distribution, you must make clear to others the license terms of this work. • Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. This is a human-readable summary of the Legal Code (the full license) [http://creativecommons.org/licenses/by-sa/2.0/legalcode/]. Table of Contents 1. Introduction and History .........................................................................1 Course Objectives ..............................................................................1 Introducing the other influence in this course ...............................1 History ..............................................................................................1 1955 .........................................................................................3 1966 .........................................................................................3 1969 to 1970 .............................................................................3 Assembler/ compilers / hardware architecture ..............................4 1971 - 1973 ...............................................................................6 1973 - 1974 ...............................................................................7 1974 - 1975 ...............................................................................7 1976 - 1978 ...............................................................................8 1979 .........................................................................................8 1980 .........................................................................................8 1977 to 1983 .............................................................................8 1989 .........................................................................................9 1992 to 1998 .............................................................................9 This is the story of Linux .................................................................10 An Introduction to Linux ..................................................................13 The story of BSD .............................................................................14 1994 1.0 release .......................................................................15 The Operations of a Unix/Linux System ............................................15 In Libraries Level ....................................................................16 Kernel .....................................................................................17 Memory ..................................................................................18 2. Booting ...............................................................................................21 What the kernel does when it starts up ..............................................21 Booting ...........................................................................................21 Switch On ...............................................................................21 3. Logging in ...........................................................................................29 Reading the Man pages - A review ...................................................29 init ..................................................................................................29 RUNLEVELS .........................................................................29 BOOTING ..............................................................................30 CHANGING RUNLEVELS .....................................................30 TELINIT(Older technology look at "init q") ..............................31 BOOTFLAGS .........................................................................31 INTERFACE ..........................................................................32 SIGNALS ...............................................................................32 Run Level versus programs ......................................................33 Default run level to go to as defined in /etc/inittab .....................33 Example Debian /etc/rcS.d/ directory ........................................34 vi Linux Internals Getty and gettdefs ....................................................................35 Terminal Emulation .........................................................................39 Terminfo (Some Extracts from stated reference material) ...........40 Terminfo Compiler (tic) ...........................................................40 Save disk space .......................................................................41 TERM ....................................................................................41 Multiple Virtual Terminals .......................................................42 Some tips ................................................................................43 In Summary ............................................................................44 4. The Kernel versus Process Management ................................................45 The Kernel ......................................................................................45 Overview of kernel/process control, resources ...........................47 Executing a process .................................................................47 Process Management .......................................................................49 Shell Command line parsing .....................................................49 Command Execution and Process Creation ................................50 Process Properties ....................................................................52 Process Life Cycle ...................................................................53 The state of a process ...............................................................55 Scheduler ................................................................................56 Linux Multitasking ..........................................................................60 Task States ..............................................................................61 Time-slicing ............................................................................61 Timer ......................................................................................62 Task switching ........................................................................63 When does switching occur? ....................................................63 5. Memory Management ..........................................................................65 The Buffer Cache ............................................................................65 The Directory Cache ........................................................................67 Paging and swapping .......................................................................67 Introduction ............................................................................67 Swap Space .............................................................................68 Swapping ................................................................................68 Paging ....................................................................................68 The working sets .....................................................................68 Implementation of swapping and paging in different systems .....69 Virtual memory .......................................................................69 6. Drivers ................................................................................................71 Introduction to drivers ......................................................................71 Driver Types ...................................................................................72 Driver Implementations ...................................................................72 Driver Management .........................................................................73 Listing currently loaded modules ..............................................73 Loading Modules .....................................................................74 Unloading modules ..................................................................74 Other module management commands ......................................74 Device Drivers ................................................................................74 vii
Recommended publications
  • Technical Standard
    Technical Standard X/Open Curses, Issue 7 The Open Group ©November 2009, The Open Group All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the copyright owners. Technical Standard X/Open Curses, Issue 7 ISBN: 1-931624-83-6 Document Number: C094 Published in the U.K. by The Open Group, November 2009. This standardhas been prepared by The Open Group Base Working Group. Feedback relating to the material contained within this standardmay be submitted by using the web site at http://austingroupbugs.net with the Project field set to "Xcurses Issue 7". ii Technical Standard 2009 Contents Chapter 1 Introduction........................................................................................... 1 1.1 This Document ........................................................................................ 1 1.1.1 Relationship to Previous Issues ......................................................... 1 1.1.2 Features Introduced in Issue 7 ........................................................... 2 1.1.3 Features Withdrawn in Issue 7........................................................... 2 1.1.4 Features Introduced in Issue 4 ........................................................... 2 1.2 Conformance............................................................................................ 3 1.2.1 Base Curses Conformance .................................................................
    [Show full text]
  • Blessed Documentation Release 1.11.0
    Blessed Documentation Release 1.11.0 Erik Rose, Jeff Quast October 10, 2015 Contents 1 Introduction 3 1.1 Brief Overview..............................................3 1.2 Before And After.............................................4 1.3 Requirements...............................................5 1.4 Further Documentation..........................................5 1.5 Bugs, Contributing, Support.......................................5 1.6 License..................................................5 1.7 Forked..................................................5 2 Overview 7 2.1 Styling and Formatting..........................................7 2.2 Moving The Cursor........................................... 10 2.3 Height And Width............................................ 11 2.4 Clearing The Screen........................................... 12 2.5 Full-Screen Mode............................................ 12 2.6 Pipe Savvy................................................ 13 2.7 Sequence Awareness........................................... 13 2.8 Keyboard Input.............................................. 14 3 Examples 17 3.1 editor.py................................................. 17 3.2 keymatrix.py............................................... 17 3.3 on_resize.py............................................... 17 3.4 progress_bar.py.............................................. 17 3.5 tprint.py................................................. 18 3.6 worms.py................................................. 18 4 Further Reading 19
    [Show full text]
  • Chapter 18 Terminal I/O
    Chapter 18 Terminal I/O Cheng-Hsin Hsu National Tsing Hua University Department of Computer Science Parts of the course materials are courtesy of Prof. Chun-Ying Huang CS5432 Advanced UNIX Programming 1 Outline • Introduction and overview • Special input characters • Getting and setting terminal attributes • Terminal option flags • stty command • Line control functions • Terminal identification • Terminal modes: Canonical, non-canonical mode, cbreak, and raw • Terminal window size • termcap, terminfo, and curses Terminal I/O 2 Introduction • The handling of terminal I/O is a messy area • The manual page for terminal I/O is usually one of the longest in the programmer’s manuals • We look at all the POSIX.1 terminal functions and some of the platform-specific additions in this chapter • Terminal I/O has two modes • Canonical mode input processing – Terminal input is processed as lines – For example, read functions return a single line • Non-canonical mode input processing – Input characters are not assembled into lines – For example, full screen editors like vi works in this mode Terminal I/O 3 Introduction (Cont’d) • Older BSD-style terminal drivers supported three modes for terminal input • (a) cooked mode – Input is collected into lines, and the special characters are processed • (b) raw mode – Input is not assembled into lines, and there is no processing of special characters • (c) cbreak mode – Input is not assembled into lines, but some of the special characters are processed • POSIX.1 defines 11 special input characters, e.g., Ctrl-D
    [Show full text]
  • Man Pages Section 3: Curses Library Functions
    man pages section 3: Curses Library Functions Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 816–0215–10 May 2002 Copyright 2002 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, and Solaris are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements.
    [Show full text]
  • Linux Backspace/Delete Mini-HOWTO Sebastiano Vigna [email protected]
    Linux Backspace/Delete mini-HOWTO Sebastiano Vigna [email protected] Revision History Revision v1.6 19 Jan 2002 Included many comments from Alex Boldt and Chung-Rui Kao. Revision v1.5 3 May 2000 Updated for new distros and the tput trick. Revision v1.4 7 December 2000 Updated for Red Hat 7.0 and Helix Gnome conflicts. Revision v1.3 18 October 2000 Name change. Revision v1.2 15 October 2000 Updated. Added "What If Nothing Works" section. Revision v1.1 13 September 2000 Added tcsh fixes Revision v1.0 5 September 2000 First release Table of Contents Introduction ...........................................................................................................................3 How Keys Are Turned Into Actions ..................................................................................3 Why It Doesn’t (Always) Work ..........................................................................................4 X................................................................................................................................................4 What You Should Do When Writing Applications ........................................................5 What You Should Do On Your System.............................................................................5 What If Nothing Works .......................................................................................................9 More Hacking........................................................................................................................9 Conclusions..........................................................................................................................10
    [Show full text]
  • NCURSES-Programming-HOWTO.Pdf
    NCURSES Programming HOWTO Pradeep Padala <[email protected]> v1.9, 2005−06−20 Revision History Revision 1.9 2005−06−20 Revised by: ppadala The license has been changed to the MIT−style license used by NCURSES. Note that the programs are also re−licensed under this. Revision 1.8 2005−06−17 Revised by: ppadala Lots of updates. Added references and perl examples. Changes to examples. Many grammatical and stylistic changes to the content. Changes to NCURSES history. Revision 1.7.1 2002−06−25 Revised by: ppadala Added a README file for building and instructions for building from source. Revision 1.7 2002−06−25 Revised by: ppadala Added "Other formats" section and made a lot of fancy changes to the programs. Inlining of programs is gone. Revision 1.6.1 2002−02−24 Revised by: ppadala Removed the old Changelog section, cleaned the makefiles Revision 1.6 2002−02−16 Revised by: ppadala Corrected a lot of spelling mistakes, added ACS variables section Revision 1.5 2002−01−05 Revised by: ppadala Changed structure to present proper TOC Revision 1.3.1 2001−07−26 Revised by: ppadala Corrected maintainers paragraph, Corrected stable release number Revision 1.3 2001−07−24 Revised by: ppadala Added copyright notices to main document (LDP license) and programs (GPL), Corrected printw_example. Revision 1.2 2001−06−05 Revised by: ppadala Incorporated ravi's changes. Mainly to introduction, menu, form, justforfun sections Revision 1.1 2001−05−22 Revised by: ppadala Added "a word about window" section, Added scanw_example. This document is intended to be an "All in One" guide for programming with ncurses and its sister libraries.
    [Show full text]
  • UNIX System V User's Reference Manual AT&T
    ATs.T ~vst8m ., UNIX® System V User's Reference Manual AT.T UNIX® System V I" User's Reference Manual AT&T Prentice-Hall, Inc., Englewood Cliffs, NJ 07632 Library of Congress Catalog Card Number: 87-60148 Editorial/production supervision: Karen S. Fortgang Cover illustration: Jim Kinstry Manufacturing buyer: S. Gordon Osbourne © 1987,1986 by AT&T. All Rights Reserved. IMPORTANT NOTICE TO USERS While every effort has been to ensure the accuracy of all information in this document, AT&T assumes no liability to any party for any loss or damage caused by errors or omissions or statements of any kind in the UNIX@ Sys­ tem V User's Reference Manual ©AT&T, its upgrades, supplements, or spe­ cial editions, whether such errors are omissions or statements resulting from negligence, accident or any other cause. AT&T further assumes no liability arising out of the application or use of any product or system described herein; nor any liability for incidental or consequential damages arising from the use of this document. AT&T disclaims all warranties regarding the infor­ mation contained herein, whether expressed, implied or statutory, including implied warranties or merchantability or fitness for a particular purpose. AT&T reserves the right to make changes without further notice to any pro­ ducts herein to improve reliability, function or design. No part of this publication may be reproduced, transmitted or used in any form or by any means-graphic, electronic, mechanical or chemical, including photocopying, recording in any medium, taping, by any computer or informa­ tion storage and retrieval systems, etc.
    [Show full text]
  • Keyboard-And-Console-HOWTO.Pdf
    The Linux keyboard and console HOWTO The Linux keyboard and console HOWTO Table of Contents The Linux keyboard and console HOWTO......................................................................................................1 Andries Brouwer, aeb@cwi.nl.................................................................................................................1 1. Useful programs...................................................................................................................................1 2. Keyboard generalities..........................................................................................................................1 3. Console generalities.............................................................................................................................1 4. Resetting your terminal........................................................................................................................1 5. Delete and Backspace..........................................................................................................................1 6. The console character sets...................................................................................................................1 7. Console switching................................................................................................................................1 8. Ctrl−Alt−Del and other special key combinations..............................................................................2 9. How to get out
    [Show full text]
  • And POSIX1 X/Open
    Standards Conformance Guide 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. Part No: 802-1953-10 A Sun Microsystems, Inc. Business Revision A, November 1995 1995 Sun Microsystems, Inc. 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Portions of this product may be derived from the UNIX® system, licensed from UNIX System Laboratories, Inc., a wholly owned subsidiary of Novell, Inc., and from the Berkeley 4.3 BSD system, licensed from the University of California. Third-party software, including font technology in this product, is protected by copyright and licensed from Sun’s suppliers. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR 52.227-19. The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications. TRADEMARKS Sun, Sun Microsystems, the Sun logo, SunSoft, the SunSoft logo, Solaris, SunOS, OpenWindows, DeskSet, ONC, ONC+, and NFS are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd.
    [Show full text]
  • GUILE NCURSES for Version 2.2, 8 April 2017
    GUILE NCURSES For version 2.2, 8 April 2017 Michael L. Gran Pradeep Padala Tom Dickey and the ncurses Team This manual is for the GNU Guile-NCurses library, (version 2.2, 8 April 2017). It provides bindings for the ncurses library, which provides functionality for updating character screens. Copyright c 1998-2010,2011,2013,2014,2016 Free Software Foundation, Inc. Copyright c 2001-2005 Pradeep Padala Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, distribute with modifications, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PAR- TICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON- TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.
    [Show full text]
  • New Curses) Library Is a Free Software Emulation of Curses in System V Release 4.0, and More
    NCURSES ANNOUNCE Announcing ncurses 5.4 The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, and has all the other SYSV-curses enhancements over BSD curses. In mid-June 1995, the maintainer of 4.4BSD curses declared that he considered 4.4BSD curses obsolete, and is encouraging the keepers of Unix releases such as BSD/OS, freeBSD and netBSD to switch over to ncurses. The ncurses code was developed under GNU/Linux. It has been in use for some time with OpenBSD as the system curses library, and on FreeBSD and NetBSD as an external package. It should port easily to any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp! The distribution includes the library and support utilities, including a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full manual pages are provided for the library and tools. The ncurses distribution is available via anonymous FTP at the GNU distribution site [1]ftp://ftp.gnu.org/gnu/ncurses/ . It is also available at [2]ftp://invisible-island.net/ncurses/ . Release Notes This release is designed to be upward compatible from ncurses 5.0 and 5.3; very few applications will require recompilation, depending on the platform. These are the highlights from the change-log since ncurses 5.3 release. Interface changes: * add the remaining functions for X/Open curses wide-character support.
    [Show full text]
  • The Art of Unix Programming by Eric Steven Raymond the Art of Unix Programming by Eric Steven Raymond Copyright © 2003 Eric S
    The Art of Unix Programming by Eric Steven Raymond The Art of Unix Programming by Eric Steven Raymond Copyright © 2003 Eric S. Raymond This book and its on-line version are distributed under the terms of the Creative Commons Attribution-NoDerivs 1.0 license, with the additional proviso that the right to publish it on paper for sale or other for-profit use is reserved to Pearson Education, Inc. A reference copy of this license may be found at http://creativecommons.org/licenses/by-nd/1.0/legalcode. AIX, AS/400, DB/2, OS/2, System/360, MVS, VM/CMS, and IBM PC are trademarks of IBM. Alpha, DEC, VAX, HP-UX, PDP, TOPS-10, TOPS-20, VMS, and VT-100 are trademarks of Compaq. Amiga and AmigaOS are trademarks of Amiga, Inc. Apple, Macintosh, MacOS, Newton, OpenDoc, and OpenStep are trademarks of Apple Computers, Inc. ClearCase is a trademark of Rational Software, Inc. Ethernet is a trademark of 3COM, Inc. Excel, MS-DOS, Microsoft Windows and PowerPoint are trademarks of Microsoft, Inc. Java. J2EE, JavaScript, NeWS, and Solaris are trademarks of Sun Microsystems. SPARC is a trademark of SPARC international. Informix is a trademark of Informix software. Itanium is a trademark of Intel. Linux is a trademark of Linus Torvalds. Netscape is a trademark of AOL. PDF and PostScript are trademarks of Adobe, Inc. UNIX is a trademark of The Open Group. The photograph of Ken and Dennis in Chapter 2 appears courtesy of Bell Labs/Lucent Technologies. The epigraph on the Portability chapter is from the Bell System Technical Journal, v57 #6 part 2 (July-Aug.
    [Show full text]