Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lectures/L16-slides-The_Readers-Writers_Problem.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions lectures/L16-slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@

Unlock works just like the regular mutex unlock.

We do not need to specify what kind of luck we are releasing.
We do not need to specify what kind of lock we are releasing.

\end{frame}

Expand Down Expand Up @@ -511,7 +511,7 @@
sem_post( &roomEmpty );
}

void* reader( void* read ) {
void* reader( void* arg ) {
pthread_mutex_lock( &mutex );
readers++;
if ( readers == 1 ) {
Expand Down Expand Up @@ -559,7 +559,7 @@
pthread_rwlock_unlock( &rwlock );
}

void* reader( void* read ) {
void* reader( void* arg ) {
pthread_rwlock_rdlock( &rwlock );
read_data( arg );
pthread_rwlock_unlock( &rwlock );
Expand Down
Binary file modified lectures/L26-Asynchronous_I_O_with_select_poll.pdf
Binary file not shown.
Binary file modified lectures/L26-slides-Asynchronous_I_O_with_select_poll.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion lectures/L26-slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@

The \texttt{readfds} are obviously sockets we are interested in reading from.

\texttt{writefds} are accordingly those we are interested in writing from.
\texttt{writefds} are accordingly those we are interested in writing to.

But what about the \texttt{exceptfds} -- this isn't Java, it's not like we're going to get a \texttt{SocketDoesNotFeelLikeDoingWorkRightNowException}.

Expand Down
2 changes: 1 addition & 1 deletion lectures/L26.tex
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ \subsection*{Third option: \texttt{select()}} Our wish is granted. The third opt

But that last one, \texttt{FD\_ISSET}, is a little different. It's not as if we would forget whether we put a file descriptor in the set. It's really for us to see what happens after \texttt{select()} is called -- we can find out whether a given file descriptor is in a particular set or not.

The \texttt{readfds} are obviously sockets we are interested in reading from and \texttt{writefds} are accordingly those we are interested in writing from. But what about the \texttt{exceptfds} -- this isn't Java, it's not like we're going to get a \texttt{SocketDoesNotFeelLikeDoingWorkRightNowException}. No, this is for sockets that are in an exceptional state, which usually means there is Out-Of-Band (OOB) data on a TCP socket. We didn't cover this earlier in network communication and we will also not be going into this subject now. But you can find out if a socket is in that state if you have a reason.
The \texttt{readfds} are obviously sockets we are interested in reading from and \texttt{writefds} are accordingly those we are interested in writing to. But what about the \texttt{exceptfds} -- this isn't Java, it's not like we're going to get a \texttt{SocketDoesNotFeelLikeDoingWorkRightNowException}. No, this is for sockets that are in an exceptional state, which usually means there is Out-Of-Band (OOB) data on a TCP socket. We didn't cover this earlier in network communication and we will also not be going into this subject now. But you can find out if a socket is in that state if you have a reason.

We don't have to use all three of \texttt{readfds}, \texttt{writefds}, and \texttt{exceptfds} in a call to \texttt{select()} if we do not need them all. If we have only read sockets, we put them all in the \texttt{readfds} set and can just give \texttt{NULL} or empty \texttt{fd\_set}s in for the other parameters~\cite{getaddrinfo}.

Expand Down