Re: When does `write' return?



Andrew Xue wrote:
> Jean-David Beyer 写道:
>
>
>> It depends on a coupla things. If you have much more than 1GBytes of
>> ram, the write could return as soon as the data get to a memory buffer.
>> Possibly some of the cache would have to be paged out, but not
>> necessarily.
>>
>
> My ram is a little bit large, 4GB. And my biggest test file is 1.8GB, so
> I think it's cached entirely.
>
>
>> It also depends if file fd is a raw file or not (if you are using raw
>> file systems, you probably already know enough to answer your
>> questions; so probably not a raw file). If it is, I believe you must
>> wait until the write completes, but OTOH, you do not need to take the
>> time to find system buffer space and copy from user space to system
>> space, and you might be able to do it in a giant "spiral write" as DEC
>> used to call it. Depends on hardware and the low level driver, I would
>> expect.
>
> Could you please explain it in more details? I could not find anything
> about "spiral write" by google. Does it mean something of copy-on-write?
>
Sorry. That was a DEC thing on their hard drives in the very late 1960s, at
least on the PDP-11 and VAX-11 series machines. It has nothing to do with
copy-on-write.

Their disks had 512-byte sectors and UNIX at the time normally read in one
sector at a time, and if it detected sequential reading, it might read the
next block as well.

But the hardware controller for the disk drives allowed you to read any
multiple of 512 bytes you wanted. I do not remember the numbers, so I will
make them up here, but you will get the idea. Imagine there are 19 tracks
per cylinder and 20 sectors per track. If you started at block zero and read
512 * 20 * 19 bytes, you would read the whole cylinder.
But if you read 512 * 20 * 29 bytes, the controller would accept that, read
the whole cylinder and do an automatic seek with no intervention from the OS
and read about half the next cylinder as well. You could go as much as you
wanted, up to almost 65536 bytes (which would use up all the data space in
any one process).


--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 22:35:00 up 14 days, 13:21, 3 users, load average: 4.19, 4.28, 4.21
.



Relevant Pages

  • Re: Converting a Bottle-Jack into a hydraulic cylinder??????
    ... So you think that the hydraulic jack cylinder is going to handle any higher pressure than the the hydraulic cylinder? ... I have a Harbor Freight Pipe bender which uses a long throw bottle jack. ... I have rigged up a system for using the dies from the pipe bender in my shop press, but the ram on my shop press is not long enough to bend 1-1/2" pipe in one shot. ...
    (rec.crafts.metalworking)
  • Re: Testing hydraulic cylinders
    ... If the piston seals are bad, the ram may not move at all, as pressure ... standing away while the cylinder lies on a blanket. ...
    (rec.crafts.metalworking)
  • Re: When does `write return?
    ... > It depends on a coupla things. ... > the write could return as soon as the data get to a memory buffer. ... My ram is a little bit large, ... > It also depends if file fd is a raw file or not (if you are using raw file ...
    (comp.os.linux.misc)
  • Re: isp driver not 64 bit?
    ... On Tuesday 30 November 2004 11:39 am, Wilko Bulte wrote: ... I haven't seen an alpha with more than 2G of ram that we booted on. ... is this a machine ram size problem or a disk volume size problem? ... number of sectors and the wrong sector size... ...
    (freebsd-hackers)
  • Re: laptop shuts down when opening up raw files with photoshop cs2
    ... >xp pro ... >only the one shuts right down after opening up a raw file to bring into ... >the preferences are set to %55 ram to be used for ps. ...
    (microsoft.public.windowsxp.help_and_support)