Re: streams and file locks, ancient OS history, ARM is sort of channeling the IBM 360

Liste des GroupesRevenir à c arch 
Sujet : Re: streams and file locks, ancient OS history, ARM is sort of channeling the IBM 360
De : johnl (at) *nospam* taugh.com (John Levine)
Groupes : comp.arch
Date : 30. Jun 2024, 19:06:36
Autres entêtes
Organisation : Taughannock Networks
Message-ID : <v5s6rc$22gn$1@gal.iecc.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
According to Anton Ertl <anton@mips.complang.tuwien.ac.at>:
An application where one writes via mmap and others read
using stdio or read/write/pread/pwrite simulataneously
is poorly designed.
>
"An application"?  I live in a world where all kinds of programs can
access the same files.  How such a program works internally is often
not known to the designers of the others.
>
In practice your advice boils down to avoiding to write with mmap().

It's more like don't try to write shared files unless you know all of
the writers are using consistent locking. Squinting at the source code
for FreeBSD's stdio, it only flushes writes when it fills the buffer
or when it writes a \n character with the '\n' hard coded in the
source code. It doesn't lock at all other than between threads in the
same task.

You need at least as many locks and flushes to keep things in sync as
you would with mapped files.

In my experience, mmap is most often used when record-granularity
is required, rather than treating the mapped region as a
stream-of-bytes.
>
I usually mmap() the whole file.

Same here, although I have used mmap() to map a whole file as well as
for database record stuff.

* You have to extend the file length with a separate system call, and
 then mmap() the new area, so you might just as well use write().
>
False economy.   ftruncate is a single system call.
>
Yes, that's the one that extends the file length.  ftruncate()
followed by mmap() are two system calls.  And at some point you also
want to msync() (although not for each ftruncate).

Seems to me the sensible thing to do is to use ftruncate and mmap to
extend the file in large chunks, say several megabytes at a time, not
one block at a time. If you have too many system calls your chunks are
not big enough.  I believe the file systems do what they do with write()
and only allocate disk blocks the first time you write to them so there
is little penalty for extending in large chunks.




 
--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Date Sujet#  Auteur
27 Jun 24 * Re: ancient OS history, ARM is sort of channeling the IBM 36054MitchAlsup1
28 Jun 24 `* Re: ancient OS history, ARM is sort of channeling the IBM 36053Lawrence D'Oliveiro
28 Jun 24  +- Re: TSS I/O, ancient OS history1John Levine
28 Jun 24  `* Re: ancient OS history, ARM is sort of channeling the IBM 36051MitchAlsup1
28 Jun 24   `* Re: ancient OS history, ARM is sort of channeling the IBM 36050Lawrence D'Oliveiro
29 Jun 24    `* Re: ancient OS history, ARM is sort of channeling the IBM 36049Stephen Fuld
29 Jun 24     `* Re: ancient OS history, ARM is sort of channeling the IBM 36048John Levine
30 Jun 24      +* Re: ancient OS history, ARM is sort of channeling the IBM 36032Lawrence D'Oliveiro
30 Jun 24      i+- Re: ancient OS history, ARM is sort of channeling the IBM 3601MitchAlsup1
30 Jun 24      i`* Re: ancient OS history, ARM is sort of channeling the IBM 36030Stephen Fuld
30 Jun 24      i +* Re: ancient OS history, ARM is sort of channeling the IBM 36024Lawrence D'Oliveiro
30 Jun 24      i i+* Re: ancient OS history, ARM is sort of channeling the IBM 36022Lynn Wheeler
30 Jun 24      i ii`* Re: ancient OS history, ARM is sort of channeling the IBM 36021John Dallman
30 Jun 24      i ii +* Re: ancient OS history, ARM is sort of channeling the IBM 36019Thomas Koenig
30 Jun 24      i ii i+* Re: ancient OS history, ARM is sort of channeling the IBM 3608Michael S
30 Jun 24      i ii ii+* Re: ancient OS history, ARM is sort of channeling the IBM 3606Thomas Koenig
30 Jun 24      i ii iii+* Re: ancient OS history, ARM is sort of channeling the IBM 3604Stephen Fuld
30 Jun 24      i ii iiii`* Re: base registers, ancient OS history, ARM is sort of channeling the IBM 3603John Levine
1 Jul 24      i ii iiii `* Re: base registers, ancient OS history, ARM is sort of channeling the IBM 3602Lawrence D'Oliveiro
1 Jul 24      i ii iiii  `- Re: base registers, ancient OS history, ARM is sort of channeling the IBM 3601John Levine
30 Jun 24      i ii iii`- Re: ancient OS history, ARM is sort of channeling the IBM 3601MitchAlsup1
30 Jun 24      i ii ii`- Re: ancient OS history, ARM is sort of channeling the IBM 3601MitchAlsup1
30 Jun 24      i ii i`* Re: ancient OS history, ARM is sort of channeling the IBM 36010John Dallman
30 Jun 24      i ii i +- Re: ancient OS history, ARM is sort of channeling the IBM 3601MitchAlsup1
30 Jun 24      i ii i `* Re: ancient OS history, ARM is sort of channeling the IBM 3608Stephen Fuld
30 Jun 24      i ii i  +- Re: small old machines, ancient OS history, ARM is sort of channeling the IBM 3601John Levine
30 Jun 24      i ii i  +* Re: ancient OS history, ARM is sort of channeling the IBM 3604John Dallman
30 Jun 24      i ii i  i+* Re: ancient OS history, ARM is sort of channeling the IBM 3602Stephen Fuld
30 Jun 24      i ii i  ii`- Re: ancient OS history, ARM is sort of channeling the IBM 3601John Dallman
30 Jun 24      i ii i  i`- Re: ancient OS history, ARM is sort of channeling the IBM 3601Lynn Wheeler
30 Jun 24      i ii i  `* Re: ancient OS history, ARM is sort of channeling the IBM 3602MitchAlsup1
1 Jul 24      i ii i   `- Re: ancient OS history, ARM is sort of channeling the IBM 3601moi
30 Jun 24      i ii `- Re: ancient OS history, ARM is sort of channeling the IBM 3601Lynn Wheeler
30 Jun 24      i i`- Re: ancient OS history, ARM is sort of channeling the IBM 3601Stephen Fuld
1 Jul 24      i `* Re: ancient OS history, ARM is sort of channeling the IBM 3605Lawrence D'Oliveiro
2 Jul 24      i  `* Re: ancient OS history, ARM is sort of channeling the IBM 3604John Levine
2 Jul 24      i   `* Re: ancient OS history, ARM is sort of channeling the IBM 3603Lawrence D'Oliveiro
2 Jul 24      i    `* Re: ancient OS history, ARM is sort of channeling the IBM 3602John Levine
2 Jul 24      i     `- Re: ancient OS history, ARM is sort of channeling the IBM 3601Dan Cross
30 Jun 24      `* Re: ancient OS history, ARM is sort of channeling the IBM 36015Anton Ertl
30 Jun 24       `* Re: ancient OS history, ARM is sort of channeling the IBM 36014Anton Ertl
30 Jun 24        `* Re: streams and file locks, ancient OS history, ARM is sort of channeling the IBM 36013John Levine
30 Jun 24         +* Re: streams and file locks, ancient OS history, ARM is sort of channeling the IBM 36010MitchAlsup1
30 Jun 24         i`* Re: streams and file locks, ancient OS history, ARM is sort of channeling9John Levine
1 Jul 24         i `* Re: streams and file locks, ancient OS history, ARM is sort of channeling8MitchAlsup1
1 Jul 24         i  `* Re: streams and file locks, ancient OS history, ARM is sort of channeling7John Levine
1 Jul 24         i   +* Re: streams and file locks, ancient OS history, ARM is sort of channeling2Lawrence D'Oliveiro
1 Jul 24         i   i`- Re: streams and file locks, ancient OS history, ARM is sort of channeling1John Levine
1 Jul 24         i   `* Re: streams and file locks, ancient OS history, ARM is sort of channeling4Michael S
1 Jul 24         i    `* Re: streams and file locks, ancient OS history, ARM is sort of channeling3MitchAlsup1
2 Jul 24         i     +- Re: streams and file locks, ancient OS history, ARM is sort of channeling1Michael S
2 Jul 24         i     `- Re: streams and file locks, ancient OS history, ARM is sort of channeling1Michael S
1 Jul 24         `* Re: streams and file locks, ancient OS history, ARM is sort of channeling the IBM 3602Lawrence D'Oliveiro
1 Jul 24          `- Re: streams and file locks, ancient OS history1John Levine

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal