User-Space-to-Kernel Interface

Slides:



Advertisements
Similar presentations
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Advertisements

Sogang University Advanced Operating Systems (Linux Device Drivers) Advanced Operating Systems (Linux Device Drivers) Sang Gue Oh, Ph.D.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
CSCI 1730 April 1 st, Materials Class notes slides & some “plain old” html & source code examples linked from course calendar board notes & diagrams.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 3 Operating System Organization.
Chap 2 System Structures.
Operating System Structure
Operating-System Structures
Linux File systems – The /proc Pawan Jain (2003CS10177) Shashwat Sehgal (2003CS10188) CSL373 - Operating Systems.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Introduction to Kernel
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Students:Gilad Goldman Lior Kamran Supervisor:Mony Orbach Mid-Semester Presentation Spring 2005 Network Sniffer.
Figure 1.1 Interaction between applications and the operating system.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
CHAPTER 13: I/O SYSTEMS Overview Overview I/O Hardware I/O Hardware I/O API I/O API I/O Subsystem I/O Subsystem Transforming I/O Requests to Hardware Operations.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
hardware and operating systems basics.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Booting and boot levels
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
COMP 3438 – Part I - Lecture 4 Introduction to Device Drivers Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
GBT Interface Card for a Linux Computer Carson Teale 1.
The Linux /proc Filesystem CSE8343 – Fall 2001 Group A1 – Alex MacFarlane, Garrick Williamson, Brad Crabtree.
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.
Guide to Linux Installation and Administration, 2e1 Chapter 2 Planning Your System.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
Operating Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose CIS 432.
Linux Architecture Overview 1. Initialization Uboot – hardware init, loads kernel Kernel – remaining initialization, calls “init” Init – 1 st process,
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.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 3 Operating Systems © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 3: Operating Systems
Silberschatz, Galvin and Gagne  Operating System Concepts UNIT II Operating System Services.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
A+ Guide to Managing and Maintaining Your PC Fifth Edition Chapter 2 How Hardware and Software Work Together.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Linux Architecture Overview.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
ECE 456 Computer Architecture Lecture #9 – Input/Output Instructor: Dr. Honggang Wang Fall 2013.
Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012.
Chapter 4: server services. The Complete Guide to Linux System Administration2 Objectives Configure network interfaces using command- line and graphical.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT Operating Systems.
Introduction to Operating Systems Concepts
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Linux Kernel Module Programming
Proc File System Sadi Evren SEKER.
Chapter 2: System Structures
Chapter 2: Operating-System Structures
Operating Systems Lecture 3.
Linux Architecture Overview.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
File Management System Simulation
Chapter 2: Operating-System Structures
Presentation transcript:

User-Space-to-Kernel Interface Chapter 3 Presenter: Mojtaba Malekpour Professor: Dr. Seyed Vahid Azhari

Introduction Application User Mode Implementation Abstraction Detail Kernel Hardware

A Question How a user application use kernel info? Example: How can find number of CPU clock in a C++ application? How can access ARP table in a application?

Mechanisms Kernel Interfaces Socket Based Ioctl Kernel System Calls Sending Signals Upcall Mmap

Kernel Interfaces Kernel Interfaces Procfs Sysfs Sysctl Configfs Debugfs

Procfs Procfs Located in /proc Originally designed to export all kind of process information Current status of the process All open file descriptors to the user space

Procfs and other purposes Provide information about the running system CPU information Interrupts information Available memory Version of kernel Information about "idle devices“ "scsi devices“ "tty's". Networking information Arp table Network statistics Lists of used sockets

Practical! Example: ls proc/ cat /proc/version cat cpuinfo cat filesystem cat /proc/looks cat /proc/net/dev cat /proc/net/arp cat /proc/net/route cat /proc/net/tcp

Practical! Example: Exe Read.c

Sysfs Represent the device model Contains information about Devices Drivers Buses Use for device Heavily structured A lot of links between the individual directories

Sysfs kernel 2.6.23 it contains the following 9 top-level directories sys/block/ all known block devices such as hda/ ram/ sda/ sys/bus/ all registered buses device/ for all devices attached to that bus driver/ for all drivers assigned with that bus. sys/class/ each device type have a subdirectory: for example /printer or /sound sys/device/ all devices known by the kernel, connected by the bus sys/firmware/ files in this directory handle the firmware of some hardware sys/fs/ files to control a file system sys/kernel/ holds directories (mount points) for other filesystems sys/module/ each kernel module loaded is represented with a directory. sys/power/ files to handle the power state of some hardware

Practical Example: cat sys/ cat sys/class/ieee80211/phy0/macaddress cat sys/class/net/wlan0/phy80211/macaddress cat sys/class/power_supply/BAT1/energy_now cat class/block/sda1/size

Configfs The configfs is some what the counterpart of the sysfs Full control by user Difference between configfs and sysfs Configfs all objects are created from user space with a call to mkdir The kernel responds with creating the attributes (files) Can be read and written by the user Use rmdir to deleted life cycle of a configfs object is fully controlled by user space

Debugfs To use RAM based file system Especially designed for debugging purposes Obtain some debugging information from their kernel code Provide set or get a single value Developer is also allowed to write its own read/write functions

Sysctl Designed to configure kernel parameters at run time Heavily used by the Linux networking subsystem It can be used to configure some core kernel parameters Represented as files in /proc/sys/* The values can be accessed by cat echo: set: only persists as long as the kernel is runningbut gets lost as soon as the machine is rebooted sysctl

Sysctl Example cat /proc/sys/net/ipv4/ip_default_ttl cat /proc/sys/net/ipv4/ipfrag_high_thresh

add a new file How can add a new file in /proc Exe jif.c Show number of clock cat /prog/jif

Ioctl Documentation/ioctl-number.txt ifconfig command uses ioctl to communicate with the kernel #include <sys/ioctl.h> int ioctl(int d, int request, ...);

Practical Exe iotcl.c Turn on and off capslook

Netlink Sockets Especially designed for the communication between the kernel space and the user space Full-duplex communication link between the Linux kernel and user space

Tanks for your attention