Question

In: Computer Science

Kernal Modul Programing Quenstion : Implement the following 4 conditions in kernel module programming. 1. Implement...

Kernal Modul Programing

Quenstion : Implement the following 4 conditions in kernel module programming.

1. Implement a timer module using the timer function provided by the file LINUX/timer.h
2. In module_init, the timer is initialized using setup_timer and called mod_timer to start the timer.
3. Call back function my_timer_callback when timer expires.
4. When you remove a module, delete the timer.

Solutions

Expert Solution

/**

* @file    hello.c

* @author Akshat Sinha

* @date 16 oct 2020

* @version 0.1

* @brief An introductory "Hello World!" loadable kernel

* module (LKM) that can display a message in the /var/log/kern.log

* file when the module is loaded and removed. The module can accept

* an argument when it is loaded -- the name, which appears in the

* kernel log files.

*/

#include <linux/module.h>     /* Needed by all modules */

#include <linux/kernel.h>     /* Needed for KERN_INFO */

#include <linux/init.h>       /* Needed for the macros */

  

///< The license type -- this affects runtime behavior

MODULE_LICENSE("GPL");

  

///< The author -- visible when you use modinfo

MODULE_AUTHOR("Akshat Sinha");

  

///< The description -- see modinfo

MODULE_DESCRIPTION("A simple Hello world LKM!");

  

///< The version of the module

MODULE_VERSION("0.1");

  

static int __init hello_start(void)

{

    printk(KERN_INFO "Loading hello module...\n");

    printk(KERN_INFO "Hello world\n");

    return 0;

}

  

static void __exit hello_end(void)

{

    printk(KERN_INFO "Goodbye Mr.\n");

}

  

module_init(hello_start);

module_exit(hello_end);


Related Solutions

This program focuses on programming with Java Collections classes. You will implement a module that finds...
This program focuses on programming with Java Collections classes. You will implement a module that finds a simplified Levenshtein distance between two words represented by strings. Your program will need support files LevenDistanceFinder.Java, dictionary.txt, while you will be implementing your code in the LevenDistanceFinder.java file. INSTRUCTIONS The Levenshtein distance, named for it's creator Vladimir Levenshtein, is a measure of the distance between two words. The edit distance between two strings is the minimum number of operations that are needed to...
Implement the following function in the PyDev module functions.py and test it from a PyDev module...
Implement the following function in the PyDev module functions.py and test it from a PyDev module named : def statistics(n): """ ------------------------------------------------------- Asks a user to enter n values, then calculates and returns the minimum, maximum, total, and average of those values. Use: minimum, maximum, total, average = statistics(n) ------------------------------------------------------- Parameters: n - number of values to process (int > 0) Returns: minimum - smallest of n values (float) maximum - largest of n values (float) total - total of...
Implement the following function in the PyDev module functions.py and test it from a PyDev module...
Implement the following function in the PyDev module functions.py and test it from a PyDev module named : def gym_cost(cost, friends): """ ------------------------------------------------------- Calculates total cost of a gym membership. A member gets a discount according to the number of friends they sign up. 0 friends: 0% discount 1 friend: 5% discount 2 friends: 10% discount 3 or more friends: 15% discount Use: final_cost = gym_cost(cost, friends) ------------------------------------------------------- Parameters: cost - a gym membership base cost (float > 0) friends...
Implement the following function in the PyDev module functions.py and test it from a PyDev module...
Implement the following function in the PyDev module functions.py and test it from a PyDev module named : def wind_speed(speed): """ ------------------------------------------------------- description Use: category = wind_speed(speed) ------------------------------------------------------- Parameters: speed - wind speed in km/hr (int >= 0) Returns: category - description of wind speed (str) ------------------------------------------------------ """ Wind speeds are categorized as: Wind speed (km/h) Category < 39 Breeze 39 - 61 Strong Wind 62 - 88 Gale Winds 89 - 117 Whole Gale > 117 Hurricane The function...
Implement the following function in the PyDev module functions.py and test it from a PyDev module...
Implement the following function in the PyDev module functions.py and test it from a PyDev module named : def fast_food(): """ ------------------------------------------------------- Food order function. Asks user for their order and if they want a combo, and if necessary, what is the side order for the combo: Prices: Burger: $6.00 Wings: $8.00 Fries combo: add $1.50 Salad combo: add $2.00 Use: price = fast_food() ------------------------------------------------------- Returns: price - the price of one meal (float) ------------------------------------------------------- """ Sample testing: Order B...
Implement the following function in the PyDev module functions.py and test it from a PyDev module...
Implement the following function in the PyDev module functions.py and test it from a PyDev module named : def is_divisible(n, i, j): """ ------------------------------------------------------- Determines if n is evenly divisible by both i and j. Use: result = is_divisible(n, i, j) ------------------------------------------------------- Parameters: n - the number to check for divisibility (int) i - one of the values to divide n by (int) j - another value to divide n by (int) Returns: result - True if n is evenly...
[1] Can you load a Linux kernel module more than once? Explain briefly. [1] For the...
[1] Can you load a Linux kernel module more than once? Explain briefly. [1] For the modules we have created in class, does the code run continuously, or does it run in response to certain events? Explain, and be specific. [1] When the kernel does a printk(), does it write directly to /var/log/kern.log? Explain. [1] The makefile for a Linux kernel module is generally very simple; however, building a module seems to be a bit complicated, generating lots of files....
Interger Programming and Nonlinear Programing are two important extensions of the basic Simplex Linear Programing model....
Interger Programming and Nonlinear Programing are two important extensions of the basic Simplex Linear Programing model. How does each differ from Simplex in theory and practice? How does Solver adjust for these two extensions? What about Rosenbrock’s method, cutting plane procedure, and interior point methods?
Use Java programming to implement the following: Implement the following methods in the UnorderedList class for...
Use Java programming to implement the following: Implement the following methods in the UnorderedList class for managing a singly linked list that cannot contain duplicates. Default constructor Create an empty list i.e., head is null. boolean insert(int data) Insert the given data into the end of the list. If the insertion is successful, the function returns true; otherwise, returns false. boolean delete(int data) Delete the node that contains the given data from the list. If the deletion is successful, the...
how to implement h / k sqrt (n) in c programing
how to implement h / k sqrt (n) in c programing
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT