How to identify the source of a disk interrupt

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

How to identify the source of a disk interrupt

Post by kemosparc »

Hi,

I have implemented two disk functions, read and write, based on polling.

Now I would like to convert them to use interrupts.

My problem is that I have multiple processes accessing disk at the same point of time and I was wondering if I can identify the source of the interrupt.

Or do I have to queue the disk operations requests coming from system calls and serve them one by one and do not proceed on the next request until the current one if served?

Thanks,
Karim.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: How to identify the source of a disk interrupt

Post by Schol-R-LEA »

I would say that some sort of synchronization and/or multiplexing is needed, at the very least, and if it is a monolithic kernel design you will almost certainly want to queue the requests, with one or more queues per file system driver (which may or may not be one-to-one to the disk drivers, BTW, so you may need to synchronize file system driver access to the disk drivers).

For a classic microkernel, you could have the message-passing system to serve as the queuing mechanism; again, each file system would have it's own message queue, as would each disk driver, though it may be possible to short-circuit the requests to go directly to the disk drivers if there is only one partition per drive and no drive spanning, albeit this would require the disk driver itself to handle the file system management as well.

In an exokernel or hypervisor (or any other system that primarily multiplexes the hardware into virtual machines without providing abstractions), you would have to multiplex the drive access instead, and probably would need to have the applications/virtual domains request exclusive access during writes.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: How to identify the source of a disk interrupt

Post by Brendan »

Hi,
kemosparc wrote:Or do I have to queue the disk operations requests coming from system calls and serve them one by one and do not proceed on the next request until the current one if served?
That's a step in the right direction, but still "improvable". If you have a queue of pending requests, you can optimise the order they're done to improve performance (instead of doing requests in "first come, first served" order). This is called "IO scheduling", and every modern OS does it in one way or another.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply