Re: How do disk writes work these days?
Re: How do disk writes work these days?
- Subject: Re: How do disk writes work these days?
- From: Lally Singh <email@hidden>
- Date: Thu, 25 Jul 2002 08:52:31 -0400
On 7/24/02 9:15 PM, "Wade Tregaskis" <email@hidden>
wrote:
>
>> I don't recall any unix system in the past 30 years that did that. Disk
>
>> writes are scheduled by the I/O subsystem, and the driver handles
>
>> talking with the device to get the data there. All of this is
>
>> generally asynchronous with respect to process activity.
>
>
>
> I think Wade meant "block [the calling process on] any disk writes and
>
> yield time to other processes". Which is in fact what happens, both now
>
> and 30 years ago.
>
>
Yes, that's what I meant. Sorry for the lack of clarity. :)
>
>
> Wade -- one thing you might want to look in to is that some operating
>
> systems implement an asynchronous I/O API in addition to traditional
>
> blocking synchronous I/O. For asynch, the difference in the sequence of
>
> events (from userland POV) is that the initial I/O call doesn't block,
>
> and there is always some mechanism to notify the process of I/O
>
> completion. In "classic" MacOS, ISTR this was done by giving the OS a
>
> pointer to a callback function, which would be called on error or
>
> completion. I think it also set a flag in the descriptor structure used
>
> to request the I/O, so you could also determine completion by polling
>
> that flag.
>
>
Is this still an efficient way of operating, in an increasingly linear [e.
>
g. single-user] OS? I'm just thinking, if you could return from writes
>
faster, the calling process can keep doing other things. My thought is
>
that you could do this without breaking existing apps by performing any
>
error checking [i.e. quickly verifying there is free space, among other
>
things] immediately, returning fail if appropriate, or otherwise returning
>
no error. You could then worry about physically getting the data to disk,
>
seeing as this is the most time intensive part...
Think about it for a second. Timothy gave you some good reasons, too, but
there's one very, very simple one too: when you give data to the disk drive
to write, it's gotta go to the platter to save the data. This takes time,
and since the write isn't done yet, the process that requested the write
can't continue on. So, you may as well run another program :-)
Timothy's response is more sophisticated, but it helps to spell out the
obvious ;-)
>
>
But, this from a newbie. I intend on acquiring some classic texts on this
>
subject [general OS level operations] - can anyone name one or two that
>
stand out?
Design of the Unix Operating System, by Marice Bach. It's a little dated,
but it's still correct where it matters.
>
_______________________________________________
>
darwin-kernel mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.