[GSOC] System V IPC in userspace week9 report

Grigore Larisa larisagrigore at gmail.com
Mon Aug 19 14:58:07 PDT 2013


Hi all,

This week I have ported the message queues implementation in userland. *
msgget* is implemented base on *shmget* and *shmat.* At the beginning a
size of PAGE_SIZE segment is obtained. It contains all metadata (message
headers, first free message header, etc) and the messages. In this way,
limits like number of messages in system are irrelevant. In this case it is
replaced with a limit per process and more messages can exist in the system
in the same time.

*msgctl* is implemented using *shmctl* and it is similar with the
semaphores approach. When a thread wants to remove a message queue, it
marks it as deleted to inform other processes. It sends the appropriate
message to the daemon and frees the memory only when no other thread in its
space address uses the message queue. For IPC_SET and IPC_STAT commands, as
in semaphores case, a message is sent to daemon in order to set/get the msg
permissions. All other fields are set/get by writing/reading in/from shared
memory.

*The msgsnd* and *msgrcv* implementation is similar with the kernel one.
Differences are related to the locking mechanism (each queue is protected
by a rwlock and it is released only when the process must wait for
messages), limits and error checks.

Thanks,
Larisa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20130820/f3ccc5f6/attachment.htm>


More information about the Kernel mailing list