Write a device driver for a character device

Assignment Help Operating System
Reference no: EM131701548

Task

Write a device driver for a character device which implements a simple way of message passing. The kernel maintains a list of messages. To limit memory usage, we impose a limit of 4KB for each message, and also impose a limit of the size of all messages, which is initially 2MB.

Your device driver should perform the following operations:

Creating the device, which has to be /dev/opsysmem, creates an empty list of messages.

Removing the device deallocates all messages and removes the list of messages.

Reading from the device returns one message, and removes this message from the kernel list. If the list of messages is empty, the reader returns -EAGAIN.

Writing to the device stores the message in kernel space and adds it to the list if the message is below the maximum size, and the limit of the size of all messages wouldn't be surpassed with this message. If the message is too big, -EINVAL is returned, and if the limit of the size of all messages was surpassed, -EAGAIN is returned.

You should also provide an ioctl which sets a new maximum size of all messages. This operation should succeed only if the new maximum is bigger than the old maximum, or if the new maximum is bigger than the size of all messages currently held. The ioctl should return 0 on success and -EINVAL on failure.

The kernel module which implements this driver must be called charDeviceDriver.ko.

Your solution must not use the kernel fifo.

You need to ensure that your code deals with multiple attempts at reading and writing at the same time. Your code should minimise the time spent in critical sections. The reader should obtain the message in the same order as they were written.

Extra task

You should implement blocking reads and writes: instead of returning -EAGAIN when reading and writing from the device, you should block the reader until a message is available. Similarly, you should block the writer until there is room for the message (in case of the writer).

For the available kernel mechanisms to achieve blocking, see the section Wait queues and Wake events'' in the device driver documentation.

Attachment:- test.rar

Verified Expert

This program is made for the communication of client and server in which one client is sending messages and server is responding for the same and also the kernel i.e server here is storing the number of messages which are used in communication.If the connection is lost it is sending EINVAL and if the message buffer is empty it is sending the message EAGAIN for defining the specifications ,inbuilt header files and function are used in the program.

Reference no: EM131701548

Questions Cloud

Describe aspects that instrument should effectively identify : Describe the key aspects that an instrument/model should effectively identify or outline in order to facilitate change.
Encumbrance and expenditure accounting : (Encumbrance and expenditure accounting) The city council appropriated $80,000 to the Parks Department for the purchase of shrubs, trees, small tools.
Advantage over developed and industrialized countries : Where may the opportunity be in developing countries and can they have an advantage over developed and industrialized countries?
How they may be different in other systems : Give two examples of these rights and explain how they may be different in other systems.
Write a device driver for a character device : Write a device driver for a character device which implements a simple way of message passing. The kernel maintains a list of messages.
What types of training materials and media are you planning : How long will the training require? What type(s) of training materials and media are you planning on using? And why?
Regards to training with technology today : What are ways that a trainer can do to keep the personal touch in regards to training with technology today? Please provide specific examples and explanations.
Preparation of financial statements : (Preparation of financial statements and interpretation of operating results) Following is the December 31, 2013, trial balance for Radnor City's General Fund.
What are some ways to simplify a strategic plan : It is important that a strategic plan is simply to understand and implement. What are some ways to simplify a strategic plan?

Reviews

inf1701548

2/28/2018 4:16:25 AM

All result gave were according to the requirements and that was also without any plagiarism. I will ask all my friends to take your help in their assignments and shall get the benefits of referral program as well.

inf1701548

11/9/2017 5:35:14 AM

Expert query: In question two servers are sending messages or one client and server are messaging to each other Please reply ASAP so that the work can be started.One client and one server are messaging to each other, they use the same list of the message, but the code should deal with multiple attempts at reading and writing at same time.

len1701548

11/1/2017 7:11:10 AM

In Canvas we had to select "Submission on Paper", since the "Submission in external tool" option is broken. However, this is just a workaround: please do not submit any paper solutions. Testing Do not modify or add files in the repository that start with test, since we use those files for scripts for testing.

len1701548

11/1/2017 7:11:02 AM

You should put all your files into a directory named exercise3 in your project on the School's git server. The The directory exercise3 must be at the top level of your project for the marking scripts to work. We will run the command make in the directory exercise3 in order to obtain all required binaries. Do not use any files or directory with the prefix "test", since we will use such files for running tests. Submission consists of pushing your solution to your project as specified above; the last submission before the submission deadline has ended counts as your submission. It is worth trying out submission well before the deadline even if the solution is not correct yet.

Write a Review

Operating System Questions & Answers

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd