The Linux /proc Filesystem CSE8343 – Fall 2001 Group A1 – Alex MacFarlane, Garrick Williamson, Brad Crabtree.

Slides:



Advertisements
Similar presentations
Devices and Drivers (Chapter 7) Khattab Alhabashi UNIX System Administration.
Advertisements

Operating System Structures
14 Macintosh OS X Internals. © 2005 Pearson Addison-Wesley. All rights reserved The Macintosh Platform 1984 – first affordable GUI Based on Motorola 32-bit.
CS252: Systems Programming Ninghui Li Topic 18: Lab 6: The Process Games.
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Linux File systems – The /proc Pawan Jain (2003CS10177) Shashwat Sehgal (2003CS10188) CSL373 - Operating Systems.
3: OS Structures 1 OPERATING SYSTEM STRUCTURES PROCESS MANAGEMENT A process is a program in execution: (A program is passive, a process active.) A process.
File System Implementation
1 UNIX 1 History of UNIX 2 Overview of UNIX 3 Processes in UNIX 4 Memory management in UNIX 5 The UNIX file system 6 Input/output in UNIX.
Chapter 2: Operating-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.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Operating Systems - Introduction S H Srinivasan
Silberschatz, Galvin and Gagne  Operating System Concepts Common OS Components Process Management Memory Management File Management I/O System.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Self Stabilizing Distributed File System Implementing a VFS Module.
Linux Installation and Administration – Lesson 5 Tutor: George Papamarkos Topic: Devices in Linux.
Cooperative Linux… “A treaty between two OS giants” Presented by: Rakesh kumar (usn: 4BD07CS084 )
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
CS 6560 Operating System Design Lecture 13 Finish File Systems Block I/O Layer.
Chapter 8. Disks and Filesystems. Ordinary Files u What is a file? –a container for ordered data –persistent (stays around) and accessible by name u Unix.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Distributed Systems. Interprocess Communication (IPC) Processes are either independent or cooperating – Threads provide a gray area – Cooperating processes.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Introduction to Operating Systems Chapter 1. cs431 -cotter2 Lecture Objectives Understand the relationship between computing hardware, operating system,
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Chapter 1 Introduction 1.1 What is an operating system
Recent advances in the Linux kernel resource management Kir Kolyshkin, OpenVZ
2.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Overview of topics covered Operating System Services.
Chapter Two Exploring the UNIX File System and File Security.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
Operating Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose CIS 432.
Chapter 5 File Management File System Implementation.
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.
OS, , Part I Operating - System Structures Department of Computer Engineering, PSUWannarat Suntiamorntut.
UNIX Unit 1- Architecture of Unix - By Pratima.
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)
User-Space-to-Kernel Interface
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Linux file systems Name: Peijun Li Student ID: Prof. Morteza Anvari.
1 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
I/O Software CS 537 – Introduction to Operating Systems.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Introduction to Operating Systems Concepts
Operating System Basics
Kernel Design & Implementation
CSC 482/582: Computer Security
Chapter 11: File System Implementation
Case Study 1: UNIX and LINUX
Proc File System Sadi Evren SEKER.
CASE STUDY 1: Linux and Android
Operating System Structure
CIT 480: Securing Computer Systems
Chapter 2: Operating-System Structures
Chapter 2: System Structures
IS3440 Linux Security Unit 7 Securing the Linux Kernel
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Presentation transcript:

The Linux /proc Filesystem CSE8343 – Fall 2001 Group A1 – Alex MacFarlane, Garrick Williamson, Brad Crabtree

Topics Introduction / History Problems Addressed Layout Process Information Kernel Information Kernel Configuration Implementation Programming for /proc Advantages & Disadvantages

Introduction What is /proc? –A pseudo-filesystem that acts as an interface to internal data structures in the kernel What is it used for? –Can be used to obtain information about the system –Can be used to change certain kernel parameters at runtime.

History The idea of a Process Filesystem –Used for reporting process information only –Seen in UNIXes such as Solaris /proc extends the concept A similar implementation available for various flavors of BSD, including FreeBSD /proc for Linux is the most actively developed

The Problem Modern kernel is highly complex Linux kernel has device drivers built-in An enormous amount of status information Many run-time configurable parameters How do we allow controlled access to kernel data and parameters and provide a familiar interface that programmers can easily adopt?

The Solution Create pseudo-filesystem to represent status information and configuration parameters as files Provides a unified ‘API’ for collecting status information and configuring drivers Control access through UNIX permissions No new libraries needed – simple filesystem calls are all that is necessary Quick, easy access via command line Not version- or configuration-specific

/proc Layout Two major subdivisions –Read-only files/directories –Configurable settings in /proc/sys/ Hierarchical Subdirectories for –Network –SCSI –IDE –Device Drivers –Etc…

# ls -la /proc

Process Information Each process has a /proc directory identified by its PID - /proc/PID/ Symlink /proc/self/ points to the process reading the file system Allows access to –Process status –Process memory information –Links to cwd, exe, root dir –CPU and Memory Map information (2.4 only)

Process Information (Example)

Kernel Information APMBusesCPUs Available Devices DMA Channels Filesystems Device Drivers Frame Buffer Devices IDE Subsystem Interrupts Memory Map I/O Ports ISA PnP Kernel Core Image Kernel Symbols Kernel Messages Load Averages Kernel Locks Memory Loaded Modules Mounted Filesystems NetworkingPartitionsRTCSCSI Statistics Swap Space SysV IPC TTY Drivers Uptime

Configuring the Kernel Read-write entries in /proc/sys/ Allow for tuning, monitoring and optimization of running kernel Modifiable only by root Parameters may be changed simply via ‘echo’ # cat /proc/sys/fs/file-max 4096 # echo 8192 > /proc/sys/fs/file-max # cat /proc/sys/fs/file-max 8192

Configuring the Kernel (Cont’d) Filesystem Data Miscellaneous Binary Formats General Kernel Parameters Virtual Memory Subsystem Device Specific Parameters Remote Procedure Calls Networking

Examples

Examples

Implementation Linux has virtual filesystem layer (VFS) VFS provides an abstraction layer between user processes and filesystems Allows for any filesystem to be used transparently in the system Filesystems don’t have to be physical /proc fileystem resides entirely in memory

Implementation – Linux VFS

Programming for /proc Simple filesystem representation allows for easy programming C calls uptimefp = myfopen (PROC_DIR "uptime"); fgets (line, sizeof (line), uptimefp); new.uptime = (unsigned long) (atof (strtok (line, " ")) * (unsigned long) HZ); Web interfaces <html><body> <? if ($fp = fopen('/proc/sys/kernel/hostname','r')) { $result = trim(fgets($fp, 4096)); echo gethostbyaddr(gethostbyname($result)); } ?> </body></html> Shell scripts – bash, PERL, etc.

Advantages & Disadvantages Advantages –Coherent, intuitive interface to the kernel –Great for tweaking and collecting status info –Easy to use and program for Disadvantages –Certain amount of overhead, must use fs calls Alleviated somewhat by sysctl() interface –User can possibly cause system instability