alecco
alecco

Reputation: 3014

Multithreading, blocking and memory mapped files

In a multi-threaded process with a memory-mapped file, what happens if one thread dereferences a page not yet in memory? Does the OS block the whole process or just that thread? What about other OSs? (BSD, OSX, Windows)

Edit: interesting report on lkml 2009

Upvotes: 1

Views: 381

Answers (1)

Gabe
Gabe

Reputation: 86718

Accessing an address not mapped into the process's virtual address space causes a hardware exception called a page fault. This will block the operating system thread until the exception is dealt with. This is the standard mode of operation for all OSes that support virtual memory.

Upvotes: 2

Related Questions