Skip to content

Commit 7640a21

Browse files
committed
mention madvise
1 parent 571bccd commit 7640a21

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

proc.tex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,10 @@
12211221
mapped as well will see the memory writes immediately.
12221222
\item memory mapping and setting access rights is used by the Electric Fence
12231223
library which is used for error detection on dynamic memory use.
1224+
\item There is also \texttt{madvise} system call that allows the process
1225+
to give the kernel some hints in how it is going to access the (mapped) memory
1226+
in given address range. E.g. the \texttt{MADV\_SEQUENTIAL} advice implies
1227+
the pages should be read-ahead and then freed once they are accessed.
12241228
\end{itemize}
12251229

12261230
%%%%%
@@ -1241,7 +1245,7 @@
12411245
while(p1 < p2) \{
12421246
c = *p1; *p1++ = *p2; *p2-- = c;
12431247
\}
1244-
\emprg{munmap}(addr, fsz);
1248+
\emprg{munmap}(addr, fsz);
12451249
\emprg{close}(fd);
12461250
return (0);
12471251
\}
@@ -1252,7 +1256,7 @@
12521256
\item This program will reverse the bytes in a file.
12531257
\item One of the advantages of shared memory segments is that it is possible
12541258
to work with the data using pointer arithmetic. Generally it is necessary
1255-
to watch out for alignment when dereferencing a pointer, e.g. on SPARC
1259+
to watch out for alignment when dereferencing a pointer, e.g. on SPARC
12561260
unaligned access will cause the \texttt{SIGBUS} signal, see example
12571261
\example{mmap/aligned.c}.
12581262
\end{itemize}
@@ -1265,7 +1269,7 @@
12651269

12661270
\begin{slide}
12671271
\sltitle{Accessing dynamic link libraries}
1268-
\texttt{void *\funnm{dlopen}(const char *\emph{path}, int \emph{mode});}
1272+
\texttt{void *\funnm{dlopen}(const char *\emph{path}, int \emph{mode});}
12691273
\begin{itemize}
12701274
\item loads \emph{path} unless already loaded, returns
12711275
a \emsl{handle} or \texttt{NULL}

0 commit comments

Comments
 (0)