Skip to content

Improve clarity in file access example #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
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
3 changes: 2 additions & 1 deletion lkmpg.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,8 @@ \subsection{Sleep}
It can then proceed to set a global variable to tell all the other processes that the file is still open and go on with its life.
When the other processes get a piece of the CPU, they'll see that global variable and go back to sleep.

So we will use \sh|tail -f| to keep the file open in the background, while trying to access it with another process (again in the background, so that we need not switch to a different vt).
So we will use \sh|tail -f| to keep the file open in the background, and attempt to access it with another background process.
This way, we don't need to switch to another terminal window or virtual terminal to run the second process.
As soon as the first background process is killed with kill \%1 , the second is woken up, is able to access the file and finally terminates.

To make our life more interesting, \cpp|module_close| does not have a monopoly on waking up the processes which wait to access the file.
Expand Down