Drivers and the Kernel. Computer Center, CS, NCTU 2 Roles of Kernel  Components of a UNIX System User-level programs Kernel Hardware  Two roles of kernel.

Slides:



Advertisements
Similar presentations
Operating-System Structures
Advertisements

Drivers and the kernel1-1 Drivers and the kernel UNIX system has three layers: m The hardware m The operating system kernel m The user-level programs Kernel.
Operating System Structures
1 OS Structure, Processes & Process Management. 2 Recap OS functions  Coordinator  Protection  Communication  Resource management  Service provider.
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
Chapter 2: Operating-System Structures
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
Common System Components
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Chapter 12 Drivers and the Kernel. Computer Center, CS, NCTU 2 Roles of Kernel  Components of a UNIX System User-level programs Kernel Hardware  Two.
Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
Abhinav Kamra Computer Science, Columbia University 3.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 3: Operating-System Structures.
 Introduction Introduction  Definition of Operating System Definition of Operating System  Abstract View of OperatingSystem Abstract View of OperatingSystem.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
System Administration HW1 huanghs. Computer Center, CS, NCTU 2 Requirements  Basic Install FreeBSD and upgrade to up-to-date –RELEASE Recompile your.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Section 3.1: Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random.
1 What is a Kernel The kernel of any operating system is the core of all the system’s software. The only thing more fundamental than the kernel is the.
Silberschatz and Galvin  Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services System Calls.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
OPERATING SYSTEMS Lecture 3: we will explore the role of the operating system in a computer Networks and Communication Department 1.
Operating System What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. An operating.
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
3.1 Operating System Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual.
Processes Introduction to Operating Systems: Module 3.
Linux Kernel Management. Module 9 – Kernel Administration ♦ Overview The innermost layer of Linux operating system is the kernel, which is a thin layer.
UNIX and Shell Programming
Drivers and the Kernel. Computer Center, CS, NCTU 2 Roles of the Kernel – (1)  Components of a UNIX System User-level programs Kernel Hardware  Kernel.
UNIX Unit 1- Architecture of Unix - By Pratima.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 3 Operating-System Structures Slide 1 Chapter 3 Operating-System Structures.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Chapter 2. System Structures
Linux Kernel Programming (LKP). LKP New sub-course New sub-course We will learn together We will learn together Evaluation of this part of course will.
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Operating System Structure Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Drivers and the Kernel. Computer Center, CS, NCTU 2 Introduction – UNIX Kernel and Shell interpret.
1.3 Operating system services An operating system provide services to programs and to the users of the program. It provides an environment for the execution.
 Components of a UNIX System › User-level programs › Kernel › Hardware  Two roles of kernel › High-level abstractions  Process managements  File system.
Introduction to Operating Systems Concepts
Computer System Structures
Operating System Kernel Compilation
Module 3: Operating-System Structures
Drivers and the Kernel lctseng arr. by pschiu.
Linux Kernel Module Programming
Chapter 4 – Introduction to Operating System Concepts
Operating System Structure
Drivers and the kernel UNIX system has three layers: Kernel
Structure of Unix OS.
Chapter 2: Operating-System Structures
Operating System Kernel Compilation
Chapter 2: System Structures
Chapter 3: Operating-System Structures
IS3440 Linux Security Unit 7 Securing the Linux Kernel
Drivers and the Kernel.
Chapter 2: Operating-System Structures
Operating Systems Lecture 3.
Drivers and the Kernel.
Operating Systems: A Modern Perspective, Chapter 3
CS533 Concepts of Operating Systems Class 13
Outline Operating System Organization Operating System Examples
Chapter 2: Operating-System Structures
Presentation transcript:

Drivers and the Kernel

Computer Center, CS, NCTU 2 Roles of Kernel  Components of a UNIX System User-level programs Kernel Hardware  Two roles of kernel High-level abstractions  Process managements –Time sharing, memory protect  File system management  Memory management  I/O management Low-level interface  drivers

Computer Center, CS, NCTU 3 Kernel Types  Two extreme types Micro kernel  Provide only necessarily, compact and small functionalities  Other functions is added via well-defined interface Monolithic kernel ( 龐大的 )  Whole functionalities in one kernel  Modern OS Solaris  Completely modular kernel  Load necessarily module when it is needed BSD-derived system  Much of the kernel's functionality is contained in modules

Computer Center, CS, NCTU 4 Kernel related directory  Build directory and location SystemBuild DirectoryKernel file FreeBSD/usr/src/sys /kernel ( < 4.x) /boot/kernel/kernel (> 5.x) Red Hat/usr/src/linux /vmlinuz or /boot/vmlinuz Solaris-/kernel/unix SunOS/usr/kvm/sys/vmunix

Computer Center, CS, NCTU 5 Why configure the kernel?  The native kernel is often big and common  Tailoring kernel to match site situation Purge unnecessary kernel devices and options Add functionalities that you want  OS patch Remedy security hole of kernel implementation  Fine-tune system performance Such as adjusting important system parameters  Adding device drivers  Fast boot time  Lower memory usage

Computer Center, CS, NCTU 6 Building a FreeBSD Kernel  Kernel source /usr/src/sys  Kernel configuration file /usr/src/sys/ /conf  GENERIC, LINT (< 4.X)  GENERIC, “ make LINT ” under this dir ( > 5.x)  Steps to build a new kernel Edit /usr/src/sys/ /conf/ % cd /usr/src ; % make KERNCONF=SABSD buildkernel % make KERNCONF=SABSD installkernel

Computer Center, CS, NCTU 7 Finding the system hardware  Before venturing into kernel configuration Get an inventory of the machine’s hardware Microsoft's Device Manager  dmesg cat /var/run/dmesg.log  pciconf man -k Atheros psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: [ITHREAD] psm0: model Generic PS/2 mouse, device ID 0 class=0x card=0x058a1014 chip=0x c vendor = 'Atheros Communications Inc.' device = 'AR5212 Atheros AR abg wireless' class = network subclass = ethernet

Computer Center, CS, NCTU 8 Building a FreeBSD Kernel – Configuration file  Each line is a control phrase [Ref] Keyword + arguments KeywordFunctionExample machineSets the machine typei386 or amd64 cpuSets the CPU type I586_CPU or HAMMER identSets the name of the kernelSABSD maxusers Sets the kernel ’ s table sizes 0 optionsSets various comiple-time optionsINET or INET6 deviceDeclares devicesfxp Pseudo-deviceDeclares pseudo-devicesloop FreeBSD 5.x~ has no Pseudo-device keyword anymore

Computer Center, CS, NCTU 9 Kernel backup  Kernel file locations Put in the /boot directory /boot/GENERIC/kernel, /boot/kernel.old/kernel /kernel.GENERIC, /kernel.old (Freebsd 4.x)  If something goes wrong ok mode !  unload kernel; load kernel.old/kernel  load kernel modules mv /boot/kernel /boot/kernel.bad

Computer Center, CS, NCTU 10 Ok mode

Computer Center, CS, NCTU 11 Tuning the FreeBSD Kernel  sysctl command Dynamically set or get kernel parameters All changes made by sysctl will be lost across reboot Use sysctl to tune the kernel and test it, then recompile the kernel Format: % sysctl [options] name[=value] … Ex: % sysctl –a list all kernel variables % sysctl –d kern.maxfilesprint the description of the variable % sysctl kern.maxfilesprint the value of the variable % sudo sysctl kern.maxfiles=2048

Computer Center, CS, NCTU 12 Kernel modules  Kernel module location /boot/kernel/*.ko /modules ( Freebsd 4.x)  kldstat  Load/unload kernel modules kldload(8), kldunload(8) zfs[/boot/kernel] -chiahung- kldstat Id Refs Address Size Name xc abd60 kernel 2 1 0xc08ac000 13b0fc zfs.ko 3 2 0xc09e8000 3d5c opensolaris.ko 4 2 0xc09ec000 16b84 krpc.ko 5 1 0xc0a c48 if_le.ko

Computer Center, CS, NCTU 13 Reference  g-config.html g-config.html  /usr/src/sys/ /conf NOTES LINT GENERIC