You could do it in your own OS, or you could patch an open-source kernel to do stuff like that. It is not possible to do it in any existing OS. Or, well, you could try with Linux's shmem mapping or Windows's VirtualAlloc. But it would be unreliable.
All the buzzt!
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law