> > My question is does Operating system interpretes any environment
> > variable for any purpose?? Or does it just see them as name-value
> > pairs??
> It just sees them as strings and does not use them for any purpose, ever
> (that I'm aware of).
> > One fact that I know is that OS is always aware that environment
> > variables exists for example there are system calls to get, set,
> > unset, clear the environment variables.
> These are not system calls, they're library calls (libc).
> > But are they used by OS in any way??
So the next question is "is OS at all aware of existence of
env-variable or it just treate them as part of address space of
For example consider following cases
1. On fork os duplicates the address space of parent process, so all
env-var also gets duplicated as side effect, without OS explicitly
knowing about env-vars. So os is not aware of env-vars in this case.
2. On exec the env-vars might be provided just like command line args,
so it seems here that OS must put them near stack. BUT it do not have
to be like that, for example after exec we can set env variable in
user context by using functions like setenv(). So os is not aware of
env-vars in this case also.
Please correct me if I am wrong.
> > For example "PATH" variable is (probably) interpreted by shell and not
> > by OS.