Skip to content

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

@teodutu

Description

@teodutu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/codeUpdate or new source code support / solution filesarea/contentContent (Markdown) updatearea/tasksUpdate to taskskind/newNew content / item

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions