0

If the default page size is 4kb and I request 8kb, what will the OS, and more specifically Linux do? I have some theories for this

  • OS will return a single page with 8KB each.
  • OS will return 2 virtual pages: each one is 4kb. In a case like this, how can the operating system translate any address in those 2 pages?

Please tell me what is the correct solution.

Thanks

1

The memory is always handled in multiples of pages. If you ask the operating system (not the C's library malloc, that handles space on a pool of pages and can hand out fractions of a page) for a page, you get a page, if you ask for 10, 10 pages it is.

| improve this answer | |
  • You mean the application will speak to OS: "Please provide for me 10 pages. each page is 4kb", not "Please provide for me 40kb" ? – hqt May 4 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.