The Linux Kernel About 6 million lines of code

Slides:



Advertisements
Similar presentations
Introduction to Linux Linux startup process Unix Shells and scripts.
Advertisements

Basic Unix system administration
Booting and Shuting Down WeeSan Lee. Roadmap Bootstrapping Boot Loaders Startup/Init Scripts Reboot & Shutdown Q&A.
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Chapter 9: Understanding System Initialization The Complete Guide To Linux System Administration.
Week 8 System Initialization and X Windows. Objectives  Summarize the major steps necessary to boot a Linux system  Configure the LILO and GRUB boot.
Booting and Shutting Down the UNIX Operating System Arcadio A. Sincero Jr. 6/6/2001 CMSC 691X, Section 6080.
Linux+ Guide to Linux Certification Chapter Nine System Initialization.
Linux+ Guide to Linux Certification, Second Edition
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Linux+ Guide to Linux Certification, Third Edition
Using tcpdump. tcpdump is a powerful tool that allows us to sniff network packets and make some statistical analysis out of those dumps. tcpdump operates.
Chapter One The Essence of UNIX.
Linux Intro Linux, the do it yourself OS Linux, successor to MINIX Linux, Unix for the masses (PC users) History:
Linux Boot Up Process Bootstrapping –Bootstrapping is the standard term for “ starting up a computer”. During bootstrapping, the kernel is loaded into.
Starting and Stopping Linux. Boot Process BIOS initializes hardware –Loads the boot sector MBR loads the bootloader –Point to kernel Kernel initializes.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Va-scanCopyright 2002, Marchany Unit 4 – The Boot Process Randy Marchany VA Tech Computing Center.
System Startup and Shutdown
Linux System Administration LINUX SYSTEM ADMINISTRATION.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2012 by Scott Orr and the Trustees of Indiana University.
Linux Filesystem Management
Booting and boot levels
Hands-On Microsoft Windows Server 2008
System Startup & Shutdown Objectives –to interpret the Unix startup and shutdown configuration files –to be able to create a customised run level Contents.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
1 Linux Basics for Networking. 2 Module - Linux Basics for Networking ♦ Overview This module focuses on the basics of networking using Redhat Enterprise.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2010 by Scott Orr and the Trustees of Indiana University.
TELE 301 Lecture 10: Scheduled … 1 Overview Last Lecture –Post installation This Lecture –Scheduled tasks and log management Next Lecture –DNS –Readings:
Day 11 SAMBA NFS Logs Managing Users. SAMBA Implements the ability for a Linux machine to communicate with and act like a Windows file server. –Implements.
Linux+ Guide to Linux Certification, Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
System Startup & Shutdown
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
UNIX (Linux) Introduction Module-1. OS Kernel In computing, the kernel is the central component of OS. It is a bridge between applications and the actual.
1 Periodic Processes and the cron Daemon The cron daemon is where all timed events are initiated. The cron system is serviced by the cron daemon. What.
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Linux Startup Process Presenter: Dipu Gupta.
Core System Services. INIT Daemon The init process is the patron of all processes. first process that gets started in any Linux/ UNIX -based system.
Chap 11 System Admin: Core Concepts. A well-maintained system… Runs quickly enough so users don’t get frustrated Has enough storage to accommodate users’
System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
Using Networks. Assignment Issues find syntax Permissions HW4 3c /proc vs /tmp vs /var.
The Linux startup process Jerry Feldman The Linux Expertise Center Hewlett-Packard Company Document produced via OpenOffice.org.
System Administration Startup Process. Why Care? ● Every process on your system comes about by following a specific chain of events from the machine startup.
Getting Started with Linux
Operating System Basics
Chap-I Network and System Configuration in Linux
...looking a bit closer under the hood
Hands On UNIX AfNOG 2010 Kigali, Rwanda
Chapter 2: System Structures
Linux Start Sequence Summary
Chapter 4 Booting and Shutdown
Hands On UNIX AfNOG X Cairo, Egypt
Chapter 2: The Linux System Part 2
SUSE Linux Enterprise Desktop Administration
LINUX SYSTEM ADMINISTRATION
Linux Architecture Overview.
Computer System Laboratory
Linux Filesystem Management
Lecture 6 Introduction to Process Management
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Objectives Topic 2.6 Understanding the boot process
Presentation transcript:

The Linux Kernel About 6 million lines of code Controls memory and process management.

The Linux Kernel

Linux & the Kernel

Kernel Version Numbering: 2.6.38.8 A.B.C.D A is the version B is the major revision C is the minor revision D are security and bug fixes 2.6.39 was the last minor revision before 3.0 is released.

Linux Boot Sequence After the BIOS/UEFI instructions are given to start the OS, A compressed version of the kernel is loaded into the first megabyte of ram. The complete kernel is expanded and loaded The kernel starts

Kernel Startup Checks memory Probes for hardware

Kernel Hardware Probe Some drivers are compiled into the kernel other drivers are loaded when the kernel starts. Everything recognized by the os has a file node associated with it. The kernel will establish nodes for each required device.

Starting the kernel Find and set up swap (virtual memory) A hardware probe is done to determine what drivers should be initialized. Read /etc/fstab to mount the root file system. Mount other devices Start a program called init. Kernel passes control to init.

Kernel startup Create tables for memory management.

Kernel Startup Dummy processes are started. These processes do not have PIDs, and cannot be killed: Swap Paging virtual memory IO activity Other (example: managing threads)

Dummy processes Swapper vhand, kflushd, kpiod, mdrecoveryd

Kernel Startup Find and mount the other partitions starting with the swap partition space. The /etc/fstab

/etc/fstab /dev/root /proc –A virtual file-system (in memory) used for managing processes. This allows loadable runtime modules to be inserted and removed as needed. /dev/pts – A VFS used for managing devices

init The first non-dummy process, PID = 1. First process to run and is always running. The kernel passes process management to init. Init reads its configuration file: /etc/inittab Directly or indirectly spawns all other processes until shutdown.

init: Processes The basis of all Linux systems. Run perpetually in the background waiting for input. Services Daemons Shells utilities

init:Services & Daemons Examples: login prompt X-Window server keyboard input functionality firewall and all classic server programs; e-mail, DNS, FTP, telnet, ssh, etc.

init the runlevel is determined by inittab: 0. Halt the system 1. Enter single-user mode (no networking) 2. Multiuser mode, without NFS. 3. Full multiuser mode 4. Unused 5. Same as runlevel 3 but with X-windows. 6. Reboot.

/etc/inittab Additional programs and services are started when init reads the contents of inittab.

inittab Each line has the same syntax: Id:runlevels:action:process Id A unique sequence of 1-4 characters to identify the line in the file (a macro). Runlevels are any combination of numbers from 0-6. If blank it implies all run levels. Action- what should happen. Process – the actual process to run.

Action Respawn – restart whenever it terminates. Wait – don’t continue until it completes. Once – will not wait for completion. boot – run at boot time. Bootwait – start at boot time and wait for completion before continuing. ondemand, initdefault, sysinit, powerwait, powerfail, powerkwait, ctrlaltdel.

Read /etc/fstab Read /etc/inittab Run /etc/rc.sysinit Run /etc/rc Run the K* and S* startup scripts.

inittab and sysinit The file rc.sysinit is a script run once at boot time to set up services specific to the computer system: Hostname Networking Etc.

rc Scripts They keep track of the large number of services to be managed. The main rc script is /etc/rc.d/rc

/etc/rc.d/rc Responsible for calling the appropriate scripts in the correct order for each run level.

/etc/rc.d/rc[0-6].d There is an additional directory for each different runlevel: 0-6. Each directory has the scripts needed to run the specified boot level. The files in these subdirectories have two classifications: kill and start.

Kill and Start Services. The letter K is the prefix to all services to be killed. The letter S is the prefix to all the services to be Started. The K & S prefixed names are links to the actual service scripts located in /etc/rc.d/init.d

Order of services A number follows the S or K prefix. The number determines the order of execution. The rc file accesses the correct run-level directory and executes the files in numerical order. K files are first, then S files.

K and S scripts Every script in the /etc/rc.d/init.d directory is run with one of two options: stop if the prefix is K start if the prefix is S /etc/rc.d/init.d/xfs start /etc/rc/d/init.d/sound stop

Adding services If a service need be installed at boot time, you can edit the /etc/rc.d/rc.local file. Or add functionality by adding a script to the /etc/rc.d/init.d directory.

Contents of Custom RC script A description of the scripts purpose. Verify the program really exists before attempting to start it. Parse for start and stop command line options. Put your script in the /etc/rc.d/init.d directory.

Link the New RC script Add new service script to the /etc/rc.d/init.d directory. cd to the correct run level directories, cd /etc/rc.d/rc5.d Add the link ln –s ../init.d/mynewservice S98mynewservice

/etc/rc.d/rc.local You can also add a service by modifying the /etc/rc.d/rc.local file. /etc/rc.d/rc[0-6].d/[K,S]99local

Core Services init – process id 1. inetd – Traditional Unix service. xinetd – Linux version of inetd. Used to manage some services: xinetd.org/faq.html syslogd – logs system messages to /var cron – used to start utilities at a pre-described time.

Review: init The parent process of all processes. Started by the kernel at boot time. If a process dies before all of its children complete, then the children inherit init as the parent (PPID = 1). Controls the run level with /etc/inittab.

inetd & xinetd Daemons – independent background processes that poll for events. Events sent to the daemons determine how the daemon behaves at any given time.

inetd Pre-Linux tool. The supervisor of network server-related processes. Rather than running many daemons taking up memory, initd polls for daemon requests. When a particular daemon gets an event, initd will activate the appropriate daemon.

xinetd Linux implementation of inetd. A list of the services currently offered by xinetd are in /etc/xinetd.d directory.

syslogd daemon With programs/services disconnected from a terminal, where does their standard output go? Syslogd routes the output of services to text files. Most log files are in /var/log Works in a heterogeneous environment.

syslogd /sbin/syslogd /etc/syslogd.conf man syslogd

/etc/syslog.conf Syntax of file involves Facility: mail, kern, daemon, lpr, other services Priority: emerg, alert, warning, err, notice, etc. Log file *.emerg @loghost,childrja,root Emergency messages are sent to machine loghost and to the console session of childrja and root.

cron Used to schedule programs to run. Cron wakes up once every minute and checks all the crontab files on the system. If an entry in one of the crontab files matches the date and time, then the designated process is run.

crontab /etc/cron.allow /etc/cron.deny Crontab file syntax: Min Hr Day Month DayofWk command