Re: fork question
- From: "David Schwartz" <davids@xxxxxxxxxxxxx>
- Date: Sun, 22 Jan 2006 15:52:53 -0800
"Eric" <nospam@xxxxxxxxx> wrote in message
news:VLednYl3AqJrZU7eRVn-gA@xxxxxxxxxxxxxx
> Well, most of it is that the child reads parent set data, but also, i have
> a
> couple of shared ints that can be set by anyone which are used as yes/no
> flags. once set, they never change but are read (ie checked) fairly often
> by the reset of the processes.
If they're set before the call to 'fork' and never change, they don't
need to be shared. There's no problem with the child making its own copy
during the call to 'fork'.
> Another q.
> I'm creating the mmap'd are like this (shortened for clarity):
>
> Global declarations:
> void *mptr;
> typedef struct _TSharedAreaMap {
> struct info sinfo[MAX_SINFOs];
> int Flag1;
> volatile int AbortOps;
> }TSharedAreaMap;
> TSharedAreaMap *SharedAreaMap;
>
> Mapping function:
> fd = open(SharedBackingFile, O_RDWR);
> mptr = mmap(0, Len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
> SharedAreaMap = (TSharedAreaMap *)mptr;
>
> Parent and child both call this but only the parent creates the backing
> file. Is that corect?
Why should both parent and child call that? Why not just call it before
you 'fork'?
DS
.
- Follow-Ups:
- Re: fork question
- From: Eric
- Re: fork question
- References:
- fork question
- From: Eric
- Re: fork question
- From: David Schwartz
- Re: fork question
- From: Eric
- fork question
- Prev by Date: Re: fork question
- Next by Date: Re: SMP and Multithreaded Applications under linux
- Previous by thread: Re: fork question
- Next by thread: Re: fork question
- Index(es):
Relevant Pages
|