Skip to content
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

chapters/compute/copy-on-write: Create task to showcase COW between related processes. #140

Open
teodutu opened this issue Nov 19, 2024 · 0 comments
Labels
area/code Update or new source code support / solution files area/content Content (Markdown) update area/tasks Update to tasks kind/new New content / item

Comments

@teodutu
Copy link

teodutu commented Nov 19, 2024

Create an exercise where a parent process makes three mmap() calls: one with MAP_PRIVATE and two with MAP_SHARED (one for an integer value, and another for a buffer). After calling fork():

  • the child and parent processes modify the buffers created with MAP_PRIVATE and display them (this demonstrates Copy-on-Write).
  • the parent and child communicate using the shared memory (one-way communication, with a busy waiting mechanism or something similar - non-optimal, for educational purposes — here, Copy-on-Write no longer applies).
    • the parent process increments the counter (first MAP_SHARED page) and writes a message in the buffer (second MAP_SHARED page)
    • the child process checks if the counter is modified (busy waiting). When it happens, the child reads the message from the buffer and displays it. If it receives the exit message written in the buffer, then the child process exits.
@teodutu teodutu added kind/new New content / item area/code Update or new source code support / solution files area/content Content (Markdown) update area/tasks Update to tasks labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/code Update or new source code support / solution files area/content Content (Markdown) update area/tasks Update to tasks kind/new New content / item
Projects
None yet
Development

No branches or pull requests

1 participant