Skip to content

Memory Management#

It's worth mentioning, briefly, how memory works from the perspective of a process and a thread (or multiple threads.)

When a process starts it gets its own allocation of memory. The kernel assigns it the memory it asks for, but it can ask for more after the fact. It's important to know that this little piece of memory the process gets is private to the process. This is by design, for security reasons.

When a process is running it can only access its own memory segment. If it tries to access another process' memory then that causes a memory violation. This security feature means that a malicious process executing on your system has a much harder time manipulating other processes (but it's far from impossible.)

A thread shares the main memory "pool" of its parent process. When the process creates another thread it too shares the same memory pool as the other threads (and this is often taken advantage of in some software engineering designs.)