Changeset 0809c4e


Ignore:
Timestamp:
Jul 23, 2022, 5:33:57 PM (23 months 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

Location:
doc/theses/thierry_delisle_PhD/thesis/text
Files:
2 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.
  • doc/theses/thierry_delisle_PhD/thesis/text/practice.tex

    rb9e2b87 r0809c4e  
    66
    77In detail, \CFA supports adding \procs using the type @processor@, in both RAII and heap coding scenarios.
    8 \begin{lstlisting}
     8\begin{cfa}
    99{
    1010        processor p[4]; // 4 new kernel threads
     
    1515        ... // execute on 4 processors
    1616} // delete 4 kernel threads
    17 \end{lstlisting}
     17\end{cfa}
    1818Dynamically allocated processors can be deleted an any time, \ie their lifetime exceeds the block of creation.
    1919The consequence is that the scheduler and \io subsystems must know when these \procs come in and out of existence and roll them into the appropriate scheduling algorithms.
     
    6868
    6969\begin{figure}
    70 \begin{lstlisting}
     70\begin{cfa}
    7171void read_lock() {
    7272        // Step 1 : make sure no writers in
     
    9292        write_lock = false;
    9393}
    94 \end{lstlisting}
     94\end{cfa}
    9595\caption{Specialized Readers-Writer Lock}
    9696\label{f:SpecializedReadersWriterLock}
Note: See TracChangeset for help on using the changeset viewer.