Chapter 1: Kernel Overview. 2 Objectives Review development and history of UNIX and Linux. Clarify the nature and extent of the kernel within the context.

Slides:



Advertisements
Similar presentations
14 Macintosh OS X Internals. © 2005 Pearson Addison-Wesley. All rights reserved The Macintosh Platform 1984 – first affordable GUI Based on Motorola 32-bit.
Advertisements

Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Operating System Structure
CS591 (Spring 2001) The Linux Kernel: Introduction.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Course Overview Introduction Computer System Structures
1 Case Study 1: UNIX and LINUX Chapter History of unix 10.2 Overview of unix 10.3 Processes in unix 10.4 Memory management in unix 10.5 Input/output.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
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.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Operating Systems - Introduction S H Srinivasan
Figure 1.1 Interaction between applications and the operating system.
CENG334 Introduction to Operating Systems Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
Comparative Operating Systems Understanding the Kernel Structure Prashant Thuppala.
Linux Operating System
Xuan Guo Chapter 1 What is UNIX? Graham Glass and King Ables, UNIX for Programmers and Users, Third Edition, Pearson Prentice Hall, 2003 Original Notes.
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.
Programming mobile devices Part II Programming Symbian devices with Symbian C++
Operating Systems Lab. (#2) University of Tehran – ECE Dept. Fall 2005 Reza Shokri
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.
Ceng Operating Systems
Chapter 10 – UNIX. History In late 1960s, two employees of Bell Labs (Ken Thompson & Dennis Ritchie) designed a new operating system to overcome the constraints.
LINUX System : Lecture 2 OS and UNIX summary Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University Acknowledgement.
Porting Linux to the Puppeteer. Getting the kernel source You will need a clean version of the linux kernel source This can be found at
ICOM Noack Operating Systems - Administrivia Prontuario - Please time-share and ask questions Info is in my homepage amadeus/~noack/ Make bookmark.
CASE STUDY 1: Linux and Android Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Overview: Linux and Unix Credit: Cailan Hao (Lancy) Instructor: Mort Anvari Date: 11/3/1999 Southeastern University (OS comparison) The symbol of Linux.
SMP, 64bit Unix and Kernel Compilation Guntis Barzdins Girts Folkmanis.
Chapter 2 Operating System Overview
Windows NT Operating System. Windows NT Models Layered Model Client/Server Model Object Model Symmetric Multiprocessing.
Chapter 1 : The Linux System Part 1 Lecture 1 10/21/
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.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 10 Case Study 1: LINUX Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Operating System Organization Chapter 3 Michelle Grieco.
Linux Overview COMS W4118 Spring Slides based on Phil Hutto, Silberschatz 2 History Linux is a modern, free operating system based on UNIX standards.
The UNIX Time-sharing system
Introduction 1 Chapter 1. Introduction History and Proliferation Mandate for Change What’s Good and Wrong Scope of this course.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Introduction to UNIX CS465. What is UNIX? (1) UNIX is an Operating System (OS). An operating system is a control program that allocates the computer's.
Linux file systems Name: Peijun Li Student ID: Prof. Morteza Anvari.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 1.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
MINIX 3 – Introduction Béat Hirsbrunner Lecture 1, 18 September 2012 Main reference Andrew S. Tanenbaum, Albert S. Woodhull Operating Systems : Design.
Getting Started with the Kernel. Obtaining the Kernel Source
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Overview of today’s lecture Major components of an operating system Structure and internal architecture of an operating system Monolithic Vs Micro-kernels.
UDel CISC361 Study Operating System principles - processes, threads - scheduling - mutual exclusion - synchronization - deadlocks - memory management -
Introduction to Operating Systems Concepts
The Linux System.
Getting Started with the Kernel
Kernel Design & Implementation
CASE STUDY 1: Linux and Android
KERNEL ARCHITECTURE.
Chapter 3: Windows7 Part 1.
Chapter 2: The Linux System Part 1
B.Ramamurthy Chapter 2 : Appendix
Operating Systems Lecture 1.
Operating Systems: A Modern Perspective, Chapter 3
Outline Operating System Organization Operating System Examples
Operating Systems Structure
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Chapter 1: Kernel Overview

2 Objectives Review development and history of UNIX and Linux. Clarify the nature and extent of the kernel within the context of the operating system proper. Identify operating system design goals and tradeoffs. Review established architectural approaches for implementing an operating system. Introduce the notion of the “core” Linux kernel. Understand the Linux approach to hardware (architecture) abstraction and independence. Explore the layout of the Linux source code tree.

3 History UNIX: 1969 Thompson & Ritchie AT&T Bell Labs BSD: 1978 Berkeley Software Distribution Commercial Vendors: Sun, HP, IBM, SGI, DEC GNU: 1984 Richard Stallman, FSF POSIX: 1986 IEEE Portable Operating System unIX Minix: 1987 Andy Tannenbaum SVR4: 1989 AT&T and Sun Linux: 1991 Linus Torvalds Intel 386 (i386) Open Source: GPL, LGPL, Cathedral and the Bazaar

4 Linux Features “UNIX-like” operating system “aims at” standards compliance “all the features you would expect in a modern UNIX” –preemptive multitasking –virtual memory (protected memory, paging) –shared libraries –demand loading, dynamic kernel modules –shared copy-on-write executables –TCP/IP networking other features: –SMP support, large memory, large files –advanced networking, advanced filesystems –efficient, stable, highly portable, supports most device hardware –active development community, support, documentation, open source –GUIs, applications

5 What’s a Kernel? aka: executive, system monitor, nucleus controls and mediates access to hardware implements and supports fundamental abstractions processes, files, devices, users, net, etc. schedules “fair” sharing of system resources memory, cpu, disk, descriptors, etc. enforces security and protection responds to user requests for service (system calls) performs routine maintenance, system checks, etc.

6 Kernel Design Goals performance: efficiency, speed –utilize resources to capacity, low overhead, code size stability: robustness, resilience –uptime, graceful degradation capability: features, flexibility, compatibility security, protection –protect users from each other, secure system from bad guys portability clarity extensibility

7 Design Tradeoffs Butler Lampson: “choose any three design goals” efficiency vs. protection –more checks, more overhead clarity vs. compatibility –ugly implementation of “broken” standards (e.g. signals) flexibility vs. security –the more you can do, the more potential security holes! not all are antagonistic –portability tends to enhance code clarity

8 Waterloo Diagrams Conceptual Concrete fs sched mm net ipc sched mm ipc vfs net

9 Stephen Tweedie’s Diagram SchedulerTrapsVMSyscalls User Processes Process Manager VFS Socket Manager Memory Allocator Math Support Network Protocols File Systems IO Requestor Packet Requestor Char Devices Block Devices Net Devices

10 Vahalia’s Diagram from Unix Internals: The New Frontiers Uresh Vahalia / Prentice-Hall 1996 core utilities virtual memory framework vnode/vfs interface exec switch block device switch scheduler framework STREAMS disk tape networktty NFS FFS s5fs elf a.out coff file device anonymous time-sharing real-time system

11 “Core” Kernel Applications System Libraries (libc) System Call Interface Hardware Architecture-Dependent Code I/O Related Process Related Scheduler Memory Management IPC File Systems Networking Device Drivers Modules

12 Architectural Approaches monolithic layered modularized micro-kernel virtual machine

13 Isolating Hardware Dependencies architecture (cpu) –dependent (/arch) –independent (everything else) abstract dependencies behind functions and macros link appropriate version at compile-time device-dependencies isolated in device drivers provide general abstractions that map to reality –e.g. three-level page tables tradeoff: exploiting special hardware features

14 Source Tree Layout /usr/src/linux Documentation arch fs init kernel include ipc drivers net mm lib scripts alpha arm i386 ia64 m68k mips mips64 ppc s390 sh sparc sparc64 acorn atm block cdrom char dio fc4 i2c i2o ide ieee1394 isdn macintosh misc net … adfs affs autofs autofs4 bfs code cramfs devfs devpts efs ext2 fat hfs hpfs … asm-alpha asm-arm asm-generic asm-i386 asm-ia64 asm-m68k asm-mips asm-mips64 … linux math-emu net pcmcia scsi video adfs affs autofs autofs4 bfs code cramfs devfs devpts efs ext2 fat hfs hpfs … 802 appletalk atm ax25 bridge core decnet econet ethernet ipv4 ipv6 ipx irda khttpd lapb …

15 linux/Documentation spotty but important collection of developer-generated documentation; you need to read what’s in here! recent effort to produce javadoc-style documentation from source header comments using OpenDoc an ambitious open-source kernel book effort has begun; see kernelbook.sourceforge.net for details some especially interesting entries: –kernel-docs.txt (a bit out of date but good) –filesystems/ (very extensive) –networking/ (very extensive) –kmod.txt –oops-tracing.txt –spinlocks.txt (the official story from Linus)

16 linux/arch subdirectories for each current port each contains kernel, lib, mm, boot and other directories whose contents override code stubs in architecture independent code lib contains highly-optimized common utility routines such as memcpy, checksums, etc. arch as of 2.4: –alpha, arm, i386, ia64, m68k, mips, mips64 –ppc, s390, sh, sparc, sparc64

17 linux/drivers largest amount of code in the kernel tree (~1.5M) device, bus, platform and general directories drivers/char – n_tty.c is the default line discipline drivers/block – elevator.c, genhd.c, linear.c, ll_rw_blk.c, raidN.c drivers/net –specific drivers and general routines Space.c and net_init.c drivers/scsi – scsi_*.c files are generic; sd.c (disk), sr.c (CD- ROM), st.c (tape), sg.c (generic) general: –cdrom, ide, isdn, parport, pcmcia, –pnp, sound, telephony, video buses – fc4, i2c, nubus, pci, sbus, tc, usb platforms – acorn, macintosh, s390, sgi

18 linux/fs contains: –virtual filesystem (VFS) framework –subdirectories for actual filesystems vfs-related files: –exec.c, binfmt_*.c - files for mapping new process images –devices.c, blk_dev.c – device registration, block device support –super.c, filesystems.c –inode.c, dcache.c, namei.c, buffer.c, file_table.c –open.c, read_write.c, select.c, pipe.c, fifo.c –fcntl.c, ioctl.c, locks.c, dquot.c, stat.c

19 linux/include include/asm-* –architecture-dependent include subdirectories include/linux –header info needed both by the kernel and user apps –usually linked to /usr/include/linux –kernel-only portions guarded by #ifdefs #ifdef __KERNEL__ /* kernel stuff */ #endif other directories: –math-emu –net –pcmcia –scsi –video

20 linux/init just two files: version.c, main.c version.c – contains the version banner that prints at boot main.c – architecture-independent boot code start_kernel is the primary entry point

21 linux/ipc System V IPC facilities if disabled at compile-time, util.c exports stubs that simply return –ENOSYS one file for each facility: –sem.c – semaphores –shm.c – shared memory –msg.c – message queues

22 linux/kernel the core kernel code sched.c – “the main kernel file” –scheduler, wait queues, timers, alarms, task queues process control –fork.c, exec.c, signal.c, exit.c –acct.c, capability.c, exec_domain.c kernel module support –kmod.c, ksyms.c, module.c other operations –time.c, resource.c, dma.c, softirq.c, itimer.c –printk.c, info.c, panic.c, sysctl.c, sys.c

23 linux/lib kernel code cannot call standard C library routines files: –brlock.c – “Big Reader” spinlocks –cmdline.c – kernel command line parsing routines –errno.c – global definition of errno –inflate.c – “gunzip” part of gzip.c used during boot –string.c – portable string code usually replaced by optimized, architecture-dependent routines –vsprintf.c – libc replacement

24 linux/mm paging and swapping –swap.c, swapfile.c (paging devices), swap_state.c (cache) –vmscan.c – paging policies, kwapd –page_io.c – low-level page transfer allocation and deallocation –slab.c – slab allocator –page_alloc.c – page-based allocator zone allocator –vmalloc.c – kernel virtual-memory allocator memory mapping –memory.c – paging, fault-handling, page table code –filemap.c – file mapping –mmap.c, mremap.c, mlock.c, mprotect.c

25 linux/net changing too fast! i haven’t figured it out yet

26 linux/scripts scripts for: –menu-based kernel configuration –kernel patching –generating kernel documentation

27 Sizes (linux test2) sizedirectoryentriesfiles loc 90M/usr/src/linux/ M 4.5MDocumentation97380 na 16.5March K 54Mdrivers M 5.6Mfs K 14.2Minclude K 28Kinit221K 120Kipc664.5K 332Kkernel252512K 80Klib882K 356Kmm191912K 5.8Mnet K 400Kscripts264212K

28 Summary Linux is a modular, UNIX-like monolithic kernel Kernel is the heart of the OS that executes with special hardware permission (kernel mode) “Core kernel” provides framework, data structures, support for drivers, modules, subsystems Kernel designers must consider many competing goals Linux source tree mirrors kernel structure Architecture dependent source subtrees live in /arch “main” lives in /kernel/init.c lxr.linux.no is a nice web-based source browser