Re: fork: out of memory

John Alvord (jalvo@cloud9.net)
Wed, 26 Nov 1997 13:18:01 -0500 (EST)


On Wed, 26 Nov 1997, Alan Cox wrote:

> > I really don't get it.
> >
> > before after
> > 0x12345 0x23456
> > blah -> files -> [ 0 ] blah -> files -> [ 0 ]
> > [ 1 ] [ 1 ]
> > ... ...
> > [ n ] ----> somefile [ n ] ----> somefile
> > ... ...
> > [ 64 ] [1024]
> >
>
> Try
>
> blah->files 0x123456, then take an interrupt, (busy)
>
> other CPU
> move blah->files
> free original
> realloc it
> scribble
>
> first CPU again
> *0123456 - wrong address
> defer file pointer
> Squawk, bang bang Im dead
>
>
That is only a problem if you free the original. Keeping the original,
with a back pointer to the fd list fro free time, and there is no race
condition.

john alvord