forked from open-education-hub/operating-systems
-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Labels
area/codeUpdate or new source code support / solution filesUpdate or new source code support / solution filesarea/contentContent (Markdown) updateContent (Markdown) updatearea/tasksUpdate to tasksUpdate to taskskind/newNew content / itemNew content / item
Description
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_PRIVATEand 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_SHAREDpage) and writes a message in the buffer (secondMAP_SHAREDpage) - 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.
- the parent process increments the counter (first
Metadata
Metadata
Assignees
Labels
area/codeUpdate or new source code support / solution filesUpdate or new source code support / solution filesarea/contentContent (Markdown) updateContent (Markdown) updatearea/tasksUpdate to tasksUpdate to taskskind/newNew content / itemNew content / item