2002-08-21 06:21:10

by Mukesh Rajan

[permalink] [raw]
Subject: detecting hard disk idleness

hi,

i'm trying to implement an alogrithm that requires as input the idleness
period of a hard disk (i.e. time between satisfying a request and arrival
of new request).

so far implementation polls "proc/stat" periodically to detect idleness
over the poll period. this implementation is not accurate and also i have
very small poll interval (milli secs). with some measurements, conclusion
is that implementation is consuming quite some power. this millisecond
polling overhead could be avoided if i can come up with an interrupt
driven implementation. in DOS, i would have manipulated the interrupt
table and inserted my code for 13h (disk interrupt right?). this would
help me do some preprocessing before the actual call to the hard disk
(13h).

is this possible in any way in Linux? i.e. have the kernel inform a
program when a hard disk interrupt occurs? either through interrupt
manipulation or otherwise?

- mukesh




2002-08-21 14:07:35

by Richard Z

[permalink] [raw]
Subject: Re: detecting hard disk idleness

On Tue, Aug 20, 2002 at 11:25:11PM -0700, Mukesh Rajan wrote:
> hi,
>
> i'm trying to implement an alogrithm that requires as input the idleness
> period of a hard disk (i.e. time between satisfying a request and arrival
> of new request).
>
> so far implementation polls "proc/stat" periodically to detect idleness
> over the poll period. this implementation is not accurate and also i have
> very small poll interval (milli secs). with some measurements, conclusion
> is that implementation is consuming quite some power. this millisecond
> polling overhead could be avoided if i can come up with an interrupt
> driven implementation. in DOS, i would have manipulated the interrupt
> table and inserted my code for 13h (disk interrupt right?). this would
> help me do some preprocessing before the actual call to the hard disk
> (13h).
>
> is this possible in any way in Linux? i.e. have the kernel inform a
> program when a hard disk interrupt occurs? either through interrupt
> manipulation or otherwise?

cat /proc/interrupts

Richard

2002-08-21 18:41:18

by Mukesh Rajan

[permalink] [raw]
Subject: Re: detecting hard disk idleness

this again would mean that i would have to poll the /proc/interrupt file.
i want to avoid polling because of very small poll interval causing
overhead. i am still wondering if this could be implemented with some sort
of interrupt mechanism in linux (kernel interrupting user program or user
program waiting on some signal)

- mukesh


On Wed, 21 Aug 2002, Richard Zidlicky wrote:

> On Tue, Aug 20, 2002 at 11:25:11PM -0700, Mukesh Rajan wrote:
> > hi,
> >
> > i'm trying to implement an alogrithm that requires as input the idleness
> > period of a hard disk (i.e. time between satisfying a request and arrival
> > of new request).
> >
> > so far implementation polls "proc/stat" periodically to detect idleness
> > over the poll period. this implementation is not accurate and also i have
> > very small poll interval (milli secs). with some measurements, conclusion
> > is that implementation is consuming quite some power. this millisecond
> > polling overhead could be avoided if i can come up with an interrupt
> > driven implementation. in DOS, i would have manipulated the interrupt
> > table and inserted my code for 13h (disk interrupt right?). this would
> > help me do some preprocessing before the actual call to the hard disk
> > (13h).
> >
> > is this possible in any way in Linux? i.e. have the kernel inform a
> > program when a hard disk interrupt occurs? either through interrupt
> > manipulation or otherwise?
>
> cat /proc/interrupts
>
> Richard
>

2002-08-21 19:02:44

by Richard B. Johnson

[permalink] [raw]
Subject: Re: detecting hard disk idleness

On Wed, 21 Aug 2002, Mukesh Rajan wrote:

> this again would mean that i would have to poll the /proc/interrupt file.
> i want to avoid polling because of very small poll interval causing
> overhead. i am still wondering if this could be implemented with some sort
> of interrupt mechanism in linux (kernel interrupting user program or user
> program waiting on some signal)
>
> - mukesh
>

Hard disk 'idleness' is something you would check at a 1-second
interval. As such, its overhead is very small.

This is a sample at 1 second intervals during a kernel compile:

11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4667 4585 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958
11: 4670 4588 IO-APIC-level BusLogic BT-958


Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.