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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Slide 19-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 19.
Booting and Shutting Down the UNIX Operating System Arcadio A. Sincero Jr. 6/6/2001 CMSC 691X, Section 6080.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
1 OS Structure, Processes & Process Management. 2 Recap OS functions  Coordinator  Protection  Communication  Resource management  Service provider.
Winter CMPE 155 Week 2. Winter Review? Computers Operating Systems Kernels Distributed Systems.
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,
Microkernels: Mach and L4
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
Operating System Organization
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.
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.
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.
UNIX System Administration OS Kernal Copyright 2002, Dr. Ken Hoganson All rights reserved. OS Kernel Concept Kernel or MicroKernel Concept: An OS architecture-design.
System Administration HW1 huanghs. Computer Center, CS, NCTU 2 Requirements  Basic Install FreeBSD and upgrade to up-to-date –RELEASE Recompile your.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
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.
Operating Systems  A collection of programs that  Coordinates computer usage among users  Manages computer resources  Handle Common Tasks.
Kernel, processes and threads Windows and Linux. Windows Architecture Operating system design Modified microkernel Layered Components HAL Interacts with.
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.
Heterogeneous Multikernel OS Yauhen Klimiankou BSUIR
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.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
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.
Scott Ferguson Section 1
Operating Systems Structure what is the organizational principle?
CS533 - Concepts of Operating Systems 1 The Mach System Presented by Catherine Vilhauer.
UNIX Unit 1- Architecture of Unix - By Pratima.
Operating System Concepts Part II Department of Computer Science Southern Illinois University Edwardsville Spring, 2009 Dr. Hiroshi Fujinoki
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 2: OS Structures (Chapter 2.7)
The Mach System Silberschatz et al Presented By Anjana Venkat.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
Computer Operating Systems And Software applications.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
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.
Systems Software / The Operating System CSC October 14, 2010.
 Components of a UNIX System › User-level programs › Kernel › Hardware  Two roles of kernel › High-level abstractions  Process managements  File system.
Chapter 2 Operating System Overview Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Introduction to Operating Systems Concepts
Computer System Structures
Computer System Structures
OPERATING SYSTEM CONCEPTS AND PRACTISE
Operating System Structures
Chapter Objectives In this chapter, you will learn:
Drivers and the Kernel lctseng arr. by pschiu.
Chapter 4 – Introduction to Operating System Concepts
Operating System Structure
Drivers and the kernel UNIX system has three layers: Kernel
CS490 Windows Internals Quiz 2 09/27/2013.
KERNEL ARCHITECTURE.
Chapter 2: Operating-System Structures
Chapter 2: System Structures
IS3440 Linux Security Unit 7 Securing the Linux Kernel
B.Ramamurthy Chapter 2 : Appendix
Drivers and the Kernel.
Chapter 2: Operating-System Structures
Drivers and the Kernel.
Operating Systems: A Modern Perspective, Chapter 3
Operating Systems Structure
Chapter 2: Operating-System Structures
Operating System Concepts
Operating System Concepts
Presentation transcript:

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 manages the resources CPU – process management Memory – memory management I/O devices – device management  Kernel provides method for Inter-process communication (IPC)  Synchronization, communication Processes to request resources  System calls

Computer Center, CS, NCTU 3 Roles of the Kernel – (2)

Computer Center, CS, NCTU 4 Kernel-wide Design Approaches  Monolithic kernels Kernel space, shared memory, fast, …, need reboot Eg. Linux, *BSD, MS-DOS, MS Windows 9x series…  Microkernels User space, message passing, slow, …, as services Eg. Mac OS X, BeOS, …  Hybrid Monolithic + Micro Eg. MS Windows NT series, DragonFly BSD, …  Nanokernels  Exokernels

Computer Center, CS, NCTU 5 Why Build a Custom Kernel  FreeBSD kernel Monolithic  modular The functionality cannot be dynamically loadable  Building a custom kernel To be an advanced BSD user Time-consuming task  Customized kernel vs. GENERIC Fast boot time Lower memory usage Additional hardware support Fine-tune system performance  Such as adjusting important system parameters

Computer Center, CS, NCTU 6 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.boot  pciconf -lv man 4 ath 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 7 Kernel Drivers and Modules  Before building a custom kernel Load kernel modules to get the specific hardware support  Kernel modules kldstat kldload  /boot/kernel/*.ko  Modify /boot/loader.conf to load modules in boot time automatically –if_ath_load="YES" kldunload zfs [/home/liuyh] -liuyh- kldstat Id Refs Address Size Name xffffffff a2dc8 kernel 2 1 0xffffffff807a3000 1abd08 zfs.ko 3 2 0xffffffff8094f000 3a68 opensolaris.ko 4 4 0xffffffff f348 krpc.ko 5 1 0xffffffff bc28 geom_label.ko

Computer Center, CS, NCTU 8 Building and Installing a Custom Kernel – (1)  Obtain full FreeBSD source tree sysinstall  Configure  Distributions  src  All csup  csup -h cvsup.tw.freebsd.org /usr/share/examples/cvsup/standard-supfile  Customized kernel configuration file Sample files  /usr/src/sys/ /conf –GENERIC, NOTES, LINT (generated by “ make LINT ” ) –/usr/src/sys/conf/NOTESfor architecture independent options Customized file  cp GENERIC /usr/local/etc/MYKERNEL  ln -s /usr/local/etc/MYKERNEL /usr/src/sys/ /conf/

Computer Center, CS, NCTU 9 Building and Installing a Custom Kernel – (2)  Building a kernel cd /usr/src make buildkernel KERNCONF=MYKERNEL make installkernel KERNCONF=MYKERNEL  kernel = buildkernel + installkernel MODULES_OVERRIDE  Set to a list of modules to build instead of all of them NO_MODULES  Set to not build modules with the kernel WITHOUT_MODULES  Set to a list of modules to exclude from the build  Kernel locations /boot/kernel/kernel /boot/kernel  /boot/kernel.old make.conf(5)

Computer Center, CS, NCTU 10 The Configuration File  Each line contains a keyword and one or more arguments KeywordFunctionExample machineSets the machine typei386 or amd64 cpuSets the CPU type I686_CPU or HAMMER identSets the name of the kernelMYKERNEL optionsSets various comiple-time optionsINET or INET6 deviceDeclares devicesfxp includeInclude another kernel config fileGENERIC nooptionsUnset optionsMD_ROOT nodeviceUnset devicesfdc

Computer Center, CS, NCTU 11 If Something Goes Wrong  Config failed Make sure the keyword is typed correctly  Make failed Look over your configuration Send mail to the FreeBSD general questions mailing list with kernel configuration  Boot failed ok mode  boot kernel.old  unload kernel && load /boot/kernel.old/kernel && boot nextboot(8)  ps(1) failed Recompile and install a world

Computer Center, CS, NCTU 12 Ok mode

Computer Center, CS, NCTU 13 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 14 Reference  References config.htmlhttp:// config.html /usr/src/sys/ /conf  NOTES  LINT  GENERIC  Further reading limits.htmlhttp:// limits.html handbook/kerneldebug.htmlhttp:// handbook/kerneldebug.html