glibc as a shared object vs. strtok
Luciano Miguel Ferreira Rocha
strange@nsk.no-ip.org
Thu Feb 5 20:50:00 GMT 2009
On Thu, Feb 05, 2009 at 09:24:28PM +0100, "Stanisław T. Findeisen" wrote:
> Hello
>
> I am having a question regarding strtok:
>
> #include <string.h>
>
> char *strtok(char *str, const char *delim);
>
> The manual page says it is not thread safe because it uses a static buffer.
> The question is: how come this function can be a part of a shared object,
> and thus be shared among multiple processes?
Because the operating system garantees process memory separation.
Usually this is implemented with COW (copy-on-write), so that the most
amount of RAM can be shared.
--
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-help/attachments/20090205/1d92eb70/attachment.sig>
More information about the Libc-help
mailing list