c - Creating a shared string array which children processes can access -
this question has answer here:
i declaring array of string using
char users[10][256]; then forking , creating 10 child processes. need each child process access , modify string array. how do ?
you'd want use shared memory.
under linux, can check this out. uses shmget, shmat , shmdt create shared memory segments, shared memory segments , detach shared memory segments respectfully.
under windows, can check this out. uses openfilemapping , mapviewoffile create "file mappings" , map them process's virtual memory respectfully.
both, finally, achieve same result.
Comments
Post a Comment