next up previous
Next: x86 implementation outline Up: Solution description Previous: Messaging system

Memory management

The microkernel must supply a mechanism to perform memory sharing. Therefore, each task owns a set of Shared Memory Objects which allow other tasks to access it's address space in a controlled way. However, there is no memory aliasing, and access is limited to reading from and writing to the shared sections using system calls that copy memory contents from one task address space to another.

The system call int share_mem(int target_task, void *addr, int size, int perms) creates a SMO of size size words6 at offset addr of the current task address space, that can be accessed by the task7 target_task. The parameter perms indicates if access is granted for reading, writing, or both. The function returns an id number that identifies the SMO just created, or -1 in case of failure. SMOs can be destroyed using the system call int claim_mem(int smo_id) and the target task of an SMO can pass it over to another task using the system call int pass_mem(int smo_id, int target_task), which changes the target task to the supplied parameter.

The system call int read_mem(int smo_id, int off, int size, void *dest) copies the size words at offset off of the SMO identified by smo_id to the address dest. Conversely, the system call int write_mem(int smo_id, int off, int size, void *src) copies size words from address src from the current task's address space to offset off of the SMO identified by smo_id. Of course, in both cases the current task must be the target task of the SMOs, and have the right permission.


next up previous
Next: x86 implementation outline Up: Solution description Previous: Messaging system
2002-09-17