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

  Information systems have become so integrated into the uk

information systems have become so integrated into the uk society and economy that the cashless society is a realistic

  Access time for reading a word from a virtual address

Consider a computer system where the overhead required for reading a word from the page table is 1.25ms. A TLB lookup of a word requires 250 ns.

  Create stockio class that is used to read from and write to

Create a StockIO class that is used to read from and write to a text file using an ArrayList. Make sure to use a delimiter between the fields; it does not have to be the # character.

  Discuss considerations for implementing an operating system

Discuss the considerations for implementing an operating and database system. Recommend the optimum system, considering the types of revenue and expense transactions for this company.

  Which values remained the same and why

Which values changed and why? Which values remained the same and why? What is the page cache? What are page tables? What is resident memory?

  Consider each scenario independently of the others

The storage medium is used as a part of an airline reservation system.

  Discuss an application that benefits barrier synchronization

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

  How to hadle users into groups using scopes in windows

Based on Active Directory proposal you completed, how to hadle users into groups using scopes available in Windows.

  Explian wired and wireless media

Discuss and explian wired and wireless media along with the drawbacks and benefits of each also Discuss the channel signaling systems used in voice communication along with the drawbacks and benefits of each.

  When a process creates a new process using the fork command

When a process creates a new process using the fork command, which of the subsequent is shared between the parent process and the child process?

  How would you transform the ptp to jsp

Packet Transmission Problem (PTP) and Job Scheduling Problems (JSP) are known NP-complete problems. How would you transform the PTP to JSP

  Lanen corporation is a major imaging solutions provider the

lanen corporation is a major imaging solutions provider. the company has three main divisions one that manufactures

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