Question: Description In this project, you will implement a kernel module that launches multiple kernel threads and implement semaphores in these threads. To make the project
Description
In this project, you will implement a kernel module that launches multiple kernel threads and
implement semaphores in these threads. To make the project interesting and to prepare for the
next project, we will implement two types of threads: producer threads and consumer threads.
Both types of threads work in infinite loops until the module is unloaded.
Implement a new module
You MUST name your module producerconsumer
It takes three arguments and you MUST name your input parameters for the kernel module
as follows such that the test script can load the kernel module successfully. Failure to do so
your kernel module will not be loaded by the automated test script and you will receive
zero grade points.
a prod: int, number of producer threads a nonnegative number
b cons: int, number of consumer threads a nonnegative number
c size: int, initializes the counting semaphore a nonnegative number
Note that the number of producerconsumer threads can be zero.
Create and start kernel threads
Use the kthreadrun function in your module to create and start the kernel threads. You
will need to start prod number of producer threads and cons number of consumer threads.
threadfn is the function to run in the thread;
data is the data pointer for threadfn; namefmt is the name for the
thread. It returns a pointer to the thread's taskstruct if the
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
