Re: How to design non blocking device drivers?
- From: Lanarcam <lanarcam1@xxxxxxxx>
- Date: Thu, 18 Sep 2008 21:49:23 +0200
Hans-Bernhard Bröker wrote:
ssubbarayan wrote:complete the writing.What would be the way to design the driver in
such a way that the second task mentioned above does not go into
blocking,but still completes writing to the EEPROM.
That would be the impossible way. You have only one EEPROM, and one EEPROM can only do one write job at a time. So task2 cannot write to the EEPROM while task1 is still doing so. That leaves three possibilities:
1) fail: refuse the write job and return an error condition
2) block: wait for the other task, write, then finish successfully
3) cache: store the write's data and report success, although it hasn't actually been written to EEPROM yet
One can also mix these, e.g. block for a while, but fail if it takes too long. But your requirement to complete writing excludes 3) and 1), and you explicitly excluded 2), which leaves you with no way to do the job.
You can also send your write requests through a queue
to a task whose job it is to do the actual writing.
There are many ways of signalling the end of the writing
through events or another queue.
The posting task can mark the operation as 'in wait'
until it receives the notification. It can wait upon
it or test it regularly. All that is well known and
is called asynchronous operations.
.
- Follow-Ups:
- Re: How to design non blocking device drivers?
- From: Hans-Bernhard Bröker
- Re: How to design non blocking device drivers?
- References:
- How to design non blocking device drivers?
- From: ssubbarayan
- Re: How to design non blocking device drivers?
- From: Hans-Bernhard Bröker
- How to design non blocking device drivers?
- Prev by Date: Re: How to design non blocking device drivers?
- Next by Date: Re: How to design non blocking device drivers?
- Previous by thread: Re: How to design non blocking device drivers?
- Next by thread: Re: How to design non blocking device drivers?
- Index(es):
Relevant Pages
|