lazy wrote:
wat will happen to a std string function like strcmp etc when the size
of the string is greater than page size of the OS?
Nothing. The standard functions needn't care -- or even know -- about
things like "the page size of the OS".
A bigger question is how will they be even stored?
As a sequence of bytes.
My guess is that this is not an issue as I assume we can malloc like
1MB(>page size),
How much space one can malloc depends on the underlying implementation.
It is, however, unlikely that malloc would restrict itself to space
less than the "page size". Why should it?
so when we try to access it,
both the pages are brought to memory. Does malloc by default tries to
allocate in the same page? If so, how will it deal with fragmentation?
It doesn't have to do anything, in general. OS's that have "page sizes"
tend to go to a great deal of trouble to arrange that programs running
under them don't need to know about them: that is rather the point about
memory mapping, after all.
--
A rock is not a fact. A rock is a rock.
Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England