I'm working on an assignment for a class involving using multiple threads, and creating pipes to communicate between the threads (all sorts of goodies). The professor gave us an example program from which to get ideas off of, only I'm having trouble figuring out what he did when he set up the shared memory. I really would like to do the program in c, but unless I can figure out what I'm doing, I'll have to resort to doing it in Java. Here's what the code looks like for setting up the shared memory resource:
//first, the variables
int smap1, i, j, k, p, sem, fd;
static int pp, ser;
caddr_t R1; //been trying to figure out what type this is
//shared memory code
/*Get map1 segment for shared array R1 */
R1=mmap(o, smap1, PROT-READ|PROT_WRITE, MAP_SHARED, fd, 0);
If any is familiar with this, any help would be appreciated. Also, can anyone recommend any good books in working with multiple threads in c? I was trying to figure out the fork() function, and am having trouble with that too!
Thanks in advance!