Git Product home page Git Product logo

os_kernal_module's Introduction

OS2021_HW1

This is operating system's homework 1, we write a kernel module to get following basic information and build a proc file in /proc/my_info

  • Version: Linux version
  • CPU:
    • processor, model name, physical id, core id, cpu cores, cache size, clflush size, cache_alignment, address sizes
  • Memory:
    • Memtotal, Memfree, Buffers, Activate, Inactivate, Shmem, Dirty, Writeback, KernelStack, PageTables
  • Time:
    • Uptime, Idletime

We also have an interface to show these info, which only get data from proc file build by self.
This assignment was done on linux 4.15.0

Setup

  1. Build and install module
make
  1. Delete other file except source code
make clean
  1. Compile module
make mod
  1. Compile app
make app
  1. Install module
make ins_mod
  1. Remove module
make rm_mod
  1. Delete app
make del_app
  1. Delete module
make del_mod

Useage

  • execute app
./app
Which information do you want?Which information do you want?
Version(v),CPU(c\),Memory(m),Time(t),All(a),Exit(e)?
v

Version: Linux version 4.15.0-72-generic
------------------------------------------------------------
Which information do you want?
Version(v),CPU(c\),Memory(m),Time(t),All(a),Exit(e)?
a


=============Version=============
Linux version 4.15.0-72-generic

=============CPU=============
processor		: 0
model name		: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
physical id		: 0
core id			: 0
cpu cores		: 2
cache size		: 4096 KB
clflush size	: 64
cache_alignment		: 64
address sizes		: 39 bits physical, 48 bits virtual

processor		: 1
model name		: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
physical id		: 0
core id			: 1
cpu cores		: 2
cache size		: 4096 KB
clflush size	: 64
cache_alignment		: 64
address sizes		: 39 bits physical, 48 bits virtual


=============Memory=============
MemTotal		:  1008948 kB
MemFree			:   335496 kB
Buffers			:    24048 kB
Active			:   332384 kB
Inactive		:   192888 kB
Shmem			:    15732 kB
Dirty			:      532 kB
Writeback		:        0 kB
KernelStack		:     7136 kB
PageTables		:    31112 kB

=============Time=============
Uptime			: 37597.24(s)
Idletime		: 68581.15(s)
------------------------------------------------------------
Which information do you want?
Version(v),CPU(c\),Memory(m),Time(t),All(a),Exit(e)?
e

os_kernal_module's People

Contributors

auyu0408 avatar github-classroom[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.