char error_flag = 0; .... // many cases of this in the code if (error) { error_flag ++; } ... if (error_flag <= 0) { Do_Radiation_Therapy(); }
time | Process 1 asks if memory is available v Process 1 gets a yes back Process 1 is interrupted Process 2 asks for memory Process 2 gets a yes back Process 2 requests memory Process 1 requests memory
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
PROT_WRITE | PROT_READ
means for read and write
MAP_SHARED
Updates to the map are visible to other processes and are reflected in the file.
MAP_PRIVATE
madvise
tells the OS that the memory is no longer needed.
A B C a D ...the library has a bug and the user will write the file.