CS 635 Advanced Systems Programming Spring 2003 Professor Allan B. Cruse University of San Francisco.

Slides:



Advertisements
Similar presentations
CSNB334 Advanced Operating Systems Course Introduction Lecturer: Asma Shakil.
Advertisements

DEVICE DRIVER VINOD KAMATH CS691X PROJECT WORK. Introduction How to write/install device drivers Systems, Kernel Programming Character, Block and Network.
Linux device-driver issues
Computer System Laboratory
Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
Computer Science 635 Advanced Systems Programming Fall 2007 Professor Allan Cruse.
Timeout for some demos An instructive look at how the Linux Operating System sets up system data-structures.
SiS 315 Graphics Engine Introduction to some capabilities of graphics accelerator hardware.
Embedded Systems Programming Writing Device Drivers.
CSS430 Introduction1 Textbook Ch1 These slides were compiled from the OSC textbook slides (Silberschatz, Galvin, and Gagne) and the instructor’s class.
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.
Kernel timing issues An introduction to the use of kernel timers and work queues.
Project #2, Linux Kernel Modifications CS-502 Fall Programming Project #2 Linux Kernel Hacking CS-502 Operating Systems Fall 2006.
The ‘net_device’ structure A look at the main kernel-object concerned with a Linux system’s network interface controller.
Computer Science 686 SPECIAL TOPIC: Programming Gigabit Ethernet Spring 2008 Professor Allan Cruse.
Scientific Visualization Using imagery to aid humans in understanding a complicated phenomenon.
Rapid prototyping of LKMs Configuring our Linux systems for the quick creation and use of loadable kernel modules.
CS 635 Advanced Systems Programming Spring 2005 Professor Allan B. Cruse University of San Francisco.
CS 635 Advanced Systems Programming Fall 2007 Professor Allan B. Cruse University of San Francisco.
Kernel timing issues An introduction to the use of kernel timers and work queues By Allan Cruise modified by sdc.
1Lecture 5 Lecture 5: Linux for Hardware Developers ECE 412: Microcomputer Laboratory.
Build an Operating System
Computer System Laboratory
CprE 458/558: Real-Time Systems (G. Manimaran)1 RTLinux Lab – Introduction Cpre 558 Anil
An Introduction to Device Drivers Sarah Diesburg COP 5641 / CIS 4930.
Operating System Program 5 I/O System DMA Device Driver.
System Calls 1.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
CS 3305 Course Overview. Introduction r Instructor: Dr Hanan Lutfiyya r Office: MC 355 r hanan at csd dot uwo ca r Office Hours: m Drop-by m Appointment.
For OS Experiments. What Do We Need? A Computer &
Winter 2015 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University Introduction and Overview.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Course Overview Ted Baker  Andy Wang COP 5641 / CIS 4930.
Introduction to Operating Systems J. H. Wang Sep. 18, 2015.
Introduction and Overview Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Old Chapter 10: Programming Tools A Developer’s Candy Store.
Sogang University Advanced Operating Systems (Linux Module Programming) Sang Gue Oh, Ph.D.
CS 390 Unix Programming Summer Unix Programming - CS 3902 Course Details Online Information Please check.
Course Overview Ted Baker  Andy Wang COP 5641 / CIS 4930.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Memory Addressing / Kernel Modules.
CSNB334 Advanced Operating Systems Course Introduction Lecturer: Abdul Rahim Ahmad.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Lab 13 Department of Computer Science and Information Engineering National Taiwan University Lab13 – Interrupt + Timer 2014/12/23 1 /16.
Design of a Modification to an Ethernet Driver Introduction The purpose of this project is to modify the Ethernet device driver so that it will not block.
LOGO System Call. Introduction System call is the mechanism used by an application program to request service from the OS. Users use it to communicate.
An Introduction to Device Drivers Ted Baker  Andy Wang COP 5641 / CIS 4930.
National Taiwan University OS Project 0 & 1 Advisor: Dr. Chih-Wen Hsueh Student: Tang-Hsun Tu 台灣大學 網媒所 / 資工所 Wireless Networking and Embedded Systems Laboratory.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
OS Project 0 February 25, Outline  Linux Installation  Linux Kernel Compilation  System Call Development  Kernel Modules / 452.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
DEVICE DRIVERS Presented by: Group 7. What are Device Drivers? Device driver or hardware driver is a program that manages the system’s interaction with.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Synchronization.
Getting Started with the Kernel. Obtaining the Kernel Source
Introduction and Overview Winter 2013 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Timers and Time Management Ok-Kyun Ha
Mathematics 202 Linear Algebra and Probability Spring 2011 Professor Allan B. Cruse Mathematics and Computer Science.
W4118 Operating Systems Junfeng Yang. What this course is about  Fundamental OS concepts  OS: one of the most crucial, almost everything thru OS  What?
Computer System Structures
Introduction to Operating Systems
SYSTEM ADMINISTRATION PART I by İlker Korkmaz and Kaya Oğuz
Linux Kernel Module Programming
Proc File System Sadi Evren SEKER.
An introduction to the use of kernel timers and work queues
An Introduction to Device Drivers
CS 6560 Operating System Design
Lab 4 Kernel Module Operating System Lab.
CS 6560 Operating System Design Kernel Loadable Modules
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

CS 635 Advanced Systems Programming Spring 2003 Professor Allan B. Cruse University of San Francisco

Instructor Contact Information Office: Harney Science Center – 212 Hours: Mon-Wed 2:30pm-4:00pm Phone: (415) Webpage: nexus.cs.usfca.edu/~cruse/

Course Textbooks Alessandro Rubini and Jonathan Corbet, Linux Device Drivers (Second Edition), O’Reilly & Associates, Incorporated (2001) M. Beck et al, Linux Kernel Programming (Third Edition), Addison-Wesley (2002)

Linux kernel modules Great mechanism for kernel ‘extensibility’ Neat tool for studying how kernel works Kernel can be modified while it’s running Unnecessary to recompile and then reboot But inherently unsafe: bugs cause system crashes!

‘Extensibility’ Modern OS needs ability to evolve Will need to support new devices Will need to allow ‘bugs’ to be fixed Will need to permit performance gains Otherwise: suffer early obsolescence!

Two Extensibility Mechanisms ‘Open Source’ programming ‘Installable’ kernel modules

‘Superuser’ privileges Modifying a running kernel is ‘risky’ Only authorized ‘system administrators’ are allowed to install kernel modules

A few ‘/proc’ examples $ cat /proc/version $ cat /proc/cpuinfo $ cat /proc/modules $ cat /proc/iomem $ cat /proc/self/maps

Module structure Two ‘module administration’ functions plus Appropriate ‘module service’ functions

Required module functions int init_module( void ); // gets called during module installation void cleanup_module( void ); // gets called during module removal

How to compile a module gcc –c –O mod.c

Using ‘insmod’ and ‘rmmod’ root# /sbin/insmod jiffies.o root# /sbin/rmmod jiffies

Using the ‘sudo’ command user$ sudo /sbin/insmod jiffies.o user$ sudo /sbin/rmmod jiffies

jiffies unsigned long volatile jiffies; global kernel variable (used by scheduler) Initialized to zero when system reboots Gets incremented when timer interrupts So it counts ‘clock-ticks’ since cpu restart ‘tick-frequency’ is architecture dependent

jiffies overflow Won’t overflow for at least 16 months Linux recently modified to ‘fix’ overflow New declaration in ‘linux/sched.h’: unsigned long longjiffies_64; and a new instruction in ‘do_timer()’ (*(u64*)&jiffies_64)++; which compiles to assembly language as add$1, jiffies+0 adc$0, jiffies+4