Ignore:
Timestamp:
Jul 23, 2022, 5:33:57 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
c4072d8e
Parents:
b9e2b87
git-author:
Peter A. Buhr <pabuhr@…> (07/23/22 17:32:58)
git-committer:
Peter A. Buhr <pabuhr@…> (07/23/22 17:33:57)
Message:

change lstlisting macro to cfa

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/thesis/text/io.tex

    rb9e2b87 r0809c4e  
    455455The following sections discuss some useful options using @read@ as an example.
    456456The standard Linux interface for C is :
    457 \begin{lstlisting}
     457\begin{cfa}
    458458ssize_t read(int fd, void *buf, size_t count);
    459 \end{lstlisting}
     459\end{cfa}
    460460
    461461\subsection{Replacement}
     
    471471Another interface option is to offer an interface different in name only.
    472472For example:
    473 \begin{lstlisting}
     473\begin{cfa}
    474474ssize_t cfa_read(int fd, void *buf, size_t count);
    475 \end{lstlisting}
     475\end{cfa}
    476476This approach is feasible and still familiar to C programmers.
    477477It comes with the caveat that any code attempting to use it must be recompiled, which is a problem considering the amount of existing legacy C binaries.
     
    481481\subsection{Asynchronous Extension}
    482482A fairly traditional way of providing asynchronous interactions is using a future mechanism~\cite{multilisp}, \eg:
    483 \begin{lstlisting}
     483\begin{cfa}
    484484future(ssize_t) read(int fd, void *buf, size_t count);
    485 \end{lstlisting}
     485\end{cfa}
    486486where the generic @future@ is fulfilled when the read completes and it contains the number of bytes read, which may be less than the number of bytes requested.
    487487The data read is placed in @buf@.
     
    489489Hence, the buffer cannot be reused until the operation completes but the synchronization does not cover the buffer.
    490490A classical asynchronous API is:
    491 \begin{lstlisting}
     491\begin{cfa}
    492492future([ssize_t, void *]) read(int fd, size_t count);
    493 \end{lstlisting}
     493\end{cfa}
    494494where the future tuple covers the components that require synchronization.
    495495However, this interface immediately introduces memory lifetime challenges since the call must effectively allocate a buffer to be returned.
     
    498498\subsection{Direct \lstinline{io_uring} Interface}
    499499The last interface directly exposes the underlying @io_uring@ interface, \eg:
    500 \begin{lstlisting}
     500\begin{cfa}
    501501array(SQE, want) cfa_io_allocate(int want);
    502502void cfa_io_submit( const array(SQE, have) & );
    503 \end{lstlisting}
     503\end{cfa}
    504504where the generic @array@ contains an array of SQEs with a size that may be less than the request.
    505505This offers more flexibility to users wanting to fully utilize all of the @io_uring@ features.
Note: See TracChangeset for help on using the changeset viewer.