Changeset 0809c4e for doc/theses/thierry_delisle_PhD/thesis
- Timestamp:
- Jul 23, 2022, 5:33:57 PM (2 years ago)
- 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)
- 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 455 455 The following sections discuss some useful options using @read@ as an example. 456 456 The standard Linux interface for C is : 457 \begin{ lstlisting}457 \begin{cfa} 458 458 ssize_t read(int fd, void *buf, size_t count); 459 \end{ lstlisting}459 \end{cfa} 460 460 461 461 \subsection{Replacement} … … 471 471 Another interface option is to offer an interface different in name only. 472 472 For example: 473 \begin{ lstlisting}473 \begin{cfa} 474 474 ssize_t cfa_read(int fd, void *buf, size_t count); 475 \end{ lstlisting}475 \end{cfa} 476 476 This approach is feasible and still familiar to C programmers. 477 477 It 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. … … 481 481 \subsection{Asynchronous Extension} 482 482 A fairly traditional way of providing asynchronous interactions is using a future mechanism~\cite{multilisp}, \eg: 483 \begin{ lstlisting}483 \begin{cfa} 484 484 future(ssize_t) read(int fd, void *buf, size_t count); 485 \end{ lstlisting}485 \end{cfa} 486 486 where 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. 487 487 The data read is placed in @buf@. … … 489 489 Hence, the buffer cannot be reused until the operation completes but the synchronization does not cover the buffer. 490 490 A classical asynchronous API is: 491 \begin{ lstlisting}491 \begin{cfa} 492 492 future([ssize_t, void *]) read(int fd, size_t count); 493 \end{ lstlisting}493 \end{cfa} 494 494 where the future tuple covers the components that require synchronization. 495 495 However, this interface immediately introduces memory lifetime challenges since the call must effectively allocate a buffer to be returned. … … 498 498 \subsection{Direct \lstinline{io_uring} Interface} 499 499 The last interface directly exposes the underlying @io_uring@ interface, \eg: 500 \begin{ lstlisting}500 \begin{cfa} 501 501 array(SQE, want) cfa_io_allocate(int want); 502 502 void cfa_io_submit( const array(SQE, have) & ); 503 \end{ lstlisting}503 \end{cfa} 504 504 where the generic @array@ contains an array of SQEs with a size that may be less than the request. 505 505 This 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 6 6 7 7 In detail, \CFA supports adding \procs using the type @processor@, in both RAII and heap coding scenarios. 8 \begin{ lstlisting}8 \begin{cfa} 9 9 { 10 10 processor p[4]; // 4 new kernel threads … … 15 15 ... // execute on 4 processors 16 16 } // delete 4 kernel threads 17 \end{ lstlisting}17 \end{cfa} 18 18 Dynamically allocated processors can be deleted an any time, \ie their lifetime exceeds the block of creation. 19 19 The 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. … … 68 68 69 69 \begin{figure} 70 \begin{ lstlisting}70 \begin{cfa} 71 71 void read_lock() { 72 72 // Step 1 : make sure no writers in … … 92 92 write_lock = false; 93 93 } 94 \end{ lstlisting}94 \end{cfa} 95 95 \caption{Specialized Readers-Writer Lock} 96 96 \label{f:SpecializedReadersWriterLock}
Note: See TracChangeset
for help on using the changeset viewer.