Getting Started with the Kernel. Obtaining the Kernel Source

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Threads, SMP, and Microkernels
OS/2 Warp Chris Ashworth Cameron Davis John Weatherley.
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Computer Systems/Operating Systems - Class 8
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
How to make a pseudo-file As a follow-up to our first lab, we examine the steps needed to create our own ‘/proc’ file.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
Comparative Operating Systems Understanding the Kernel Structure Prashant Thuppala.
MDK-ARM Microcontroller Development Kit MDK: Microcontroller Development Kit.
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
Kernel, processes and threads Windows and Linux. Windows Architecture Operating system design Modified microkernel Layered Components HAL Interacts with.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems CSCI-6140 – Computer Operating Systems David Goldschmidt, Ph.D.
1 Threads, SMP, and Microkernels Chapter 4. 2 Focus and Subtopics Focus: More advanced concepts related to process management : Resource ownership vs.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Memory Management 3 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Operating Systems. Definition An operating system is a collection of programs that manage the resources of the system, and provides a interface between.
Windows NT Operating System. Windows NT Models Layered Model Client/Server Model Object Model Symmetric Multiprocessing.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
CE Operating Systems Lecture 3 Overview of OS functions and structure.
CSNB334 Advanced Operating Systems 3a. Working with the Linux Community Lecturer: Abdul Rahim Ahmad.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
Linux Architecture Overview 1. Initialization Uboot – hardware init, loads kernel Kernel – remaining initialization, calls “init” Init – 1 st process,
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Processes Introduction to Operating Systems: Module 3.
Scott Ferguson Section 1
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
UNIX Unit 1- Architecture of Unix - By Pratima.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
Operating System 4 THREADS, SMP AND MICROKERNELS.
ICOM Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
The Performance of Micro-Kernel- Based Systems H. Haertig, M. Hohmuth, J. Liedtke, S. Schoenberg, J. Wolter Presentation by: Tim Hamilton.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
OS Labs 2/25/08 Frans Kaashoek MIT
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Kernel Structure and Infrastructure David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Introduction to Operating Systems Concepts
Computer System Structures
Ch 2. Getting Started with the Kernel
Getting Started with the Kernel
CS 3214 Computer Systems Lecture 9 Godmar Back.
Session 3 Memory Management
CS490 Windows Internals Quiz 2 09/27/2013.
OS Organization.
Threads, SMP, and Microkernels
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 2: The Linux System Part 3
Kernel Structure and Infrastructure
Lecture 4- Threads, SMP, and Microkernels
B.Ramamurthy Chapter 2 : Appendix
Operating System 4 THREADS, SMP AND MICROKERNELS
Linux Architecture Overview.
Outline Operating System Organization Operating System Examples
Presentation transcript:

Getting Started with the Kernel

Obtaining the Kernel Source

Lines of code

The Kernel Source Tree DirectoryDescription arch Architecture-specific source crypto Crypto API Documentation Kernel source documentation drivers Device drivers fs The VFS and the individual file systems include Kernel headers init Kernel boot and initialization ipc Interprocess communication code kernel Core subsystems, such as the scheduler lib Helper routines mm Memory management subsystem and the VM net Networking subsystem scripts Scripts used to build the kernel security Linux Security Module sound Sound subsystem usr Early user-space code (called initramfs)

A Beast of a Different Nature (in kernel mode) The kernel does not have access to the C library. The kernel is coded in GNU C. (not in ANSI C) The kernel lacks memory protection like user-space. The kernel cannot easily use floating point. The kernel has a small fixed- size stack. Because the kernel has asynchronous interrupts, is preemptive, and supports SMP, synchronization and concurrency are major concerns within the kernel. Portability is important.

Different Natures No libc support – There are multiple reasons for this, including some chicken-and-the-egg situations, but the primary reason is speed and size (upcall?). – Many of the usual libc functions have been implemented inside the kernel. For example

Inline Functions An inline function is declared when the keywords static and inline are used as part of the function definition. For example: static inline void wolf(unsigned long tail_size) – Because they are marked static, an exported function is not created.

Inline Assembly unsigned int low, high; asm volatile("rdtsc" : "=a" (low), "=d" (high)); /* low and high now contain the lower and upper 32-bits of the 64-bit tsc */

Branch Annotation /* we predict 'success' is nearly always nonzero... */ if (likely(success)) { /*... */ }

“Linux System Programming” Robert Love Appendix: GCC Extensions to the C Language Note: GCC & ANSI C

No (Easy) Use of Floating Point When a user-space process uses floating-point instructions, the kernel manages the transition from integer to floating point mode. Unlike user-space, the kernel does not have the luxury of seamless support for floating point because it cannot easily trap itself.

Recompile GNU‘s libc with option “-- without-fp” to avoid using floating-point hardware while providing floating-point computations Compile the module's.c files with gcc's – "-msoft-float" option and – "-D__NO_MATH_INLINES". Note: “DO” have some floating-point computations

Small, Fixed-Size Stack The user-space stack can dynamically grow The kernel stack is small and fixed in size – Historically, the kernel stack is two pages. – Recently, the size of kernel stack is one page only!!!

Synchronization and Concurrency Linux is a preemptive multitasking operating system. The Linux kernel is preemptive. Linux supports symmetrical multiprocessing – For example, Linux can use more than one core/processor to decode TCP/IP packets (named softirq) Interrupts occur asynchronously

Conclusion It is imperative that you read and modify the kernel source – Only through actually reading and experimenting with the code can you ever understand it. – The source is freely available—use it! –

homework Use “git” to maintain your kernel source tree Compile a Linux kernel