Professional Documents
Culture Documents
Mechanism of Determining Page Faults Instantaneously Via Device Driver Based Approach in Linux
Mechanism of Determining Page Faults Instantaneously Via Device Driver Based Approach in Linux
Mechanism of Determining Page Faults Instantaneously Via Device Driver Based Approach in Linux
presented by:
INTRODUCTION
Basic operating system concepts. Introduction to linux module programming. Compile and install linux module. Determining Page faults using a linux module
Code space= instructions Data space = global data variables Stack= function's local variables Heap= dynamic variables
CPU
Process 1
cpu
Program 1
Program 2
loading
Program 100
Let us take machine with 32 bit architecture It is work in multiprocess environment, here We taken 100 process
Process 100
User space
Paging process:
Entry 1 Inside CPU (TLB) protection Entry 2 Entry 3 Entry 4 Entry 5 Entry 2^10 RAM
Present/absent
Bit 1
Bit 2
Major fault: process exist, but no page table entry. Minor fault: table entry exist but not in TLB/ protection case
Operating system(kernel) is a software that manage different process and different devices. Here process get services from kernel via system calls and to manage devices(all hardware parts) we need device drivers.
A process = program code in a memory (RAM) + process management data Structure( can be called as task structure) Here only kernel can access the task structure. Using this data structure kernel will schedule each process, manage all hardware services to each process, manage all system calls, etc.
In linux all I/0 devices are accessed via Virtual File System(VFS).
Character devices are slow devices(by each bytes). Block devices are very high speed devices(block of 512 bytes)
In Linux we have below task structure definition, which is circular-doubly Linked list. struct task_struct { volatile Long state; int pid, pgrp; // using pid kernel will identify each process// int min_flt, maj_flt; struct file * fd[]; struct task_struct *next_task; //used for implementing doubly struct task_struct *prev_task; linked list// next_task (struct task_struct *); prev_task(struct task_struct *); ---------------}; Kernel and modules Kernel=base kernel + modules; Linux uses monolithical kernel architecture (modules can be added), modules can dynamically added and removed. Modules can be for software purposes and device driver purpose.
Steps in compiling and Installing a module: 1)Create a makefile for kernel build system. Then place it in our module source directory 2)Execute make command and build the driver module(get *.ko file). 3)Insert it with base kernel by executing insmod command. 4)See program out put. 5)Remove our module by executing rmmod command.
CONCLUSION
We have studied memory management and process management in an operating system. with emphasis on linux process management. We can now write a linux driver module, compile and install it. We have captured number of page fault(both minor and major) of all process in linux based system. The observation done here is that higher the number of processes running in user space, the higher the probability of occurrence of page faults
References
Robert Love, Linux Kernel Development hardwar (says more about kernel data structures) Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman. Linux Device Drivers Bovet, Daniel P. and Cesate, Marco. Understanding the Linux Kernel. (more about hardware aspects of linux kernel)