How does the operating system read the page size from hardware?












1















Books on operating systems usually mentions that the page size is decided by the processor architecture, for example Intel x86 supports 4KB page size. I have a perception that when we were installing an operating system on our hardware, the OS had read the page size of 4KB from hardware and logically divided the virtual address space into 4KB size pages and memory into frames respectively.



If my perception is true, from where or from which location in hardware does the operating system read this value of 4KB from the processor? What mechanism does the OS use to determine the page size provided by hardware? Can anybody enlighten me on this? How (On What Basis) Intel decides to keep 4KB page size.










share|improve this question

























  • Wow that’s a significant edit — “how does Intel decide to keep 4KB page size?” is a rather different matter than “how does the operating system read the page size?”

    – Stephen Kitt
    Jan 22 at 14:58
















1















Books on operating systems usually mentions that the page size is decided by the processor architecture, for example Intel x86 supports 4KB page size. I have a perception that when we were installing an operating system on our hardware, the OS had read the page size of 4KB from hardware and logically divided the virtual address space into 4KB size pages and memory into frames respectively.



If my perception is true, from where or from which location in hardware does the operating system read this value of 4KB from the processor? What mechanism does the OS use to determine the page size provided by hardware? Can anybody enlighten me on this? How (On What Basis) Intel decides to keep 4KB page size.










share|improve this question

























  • Wow that’s a significant edit — “how does Intel decide to keep 4KB page size?” is a rather different matter than “how does the operating system read the page size?”

    – Stephen Kitt
    Jan 22 at 14:58














1












1








1


1






Books on operating systems usually mentions that the page size is decided by the processor architecture, for example Intel x86 supports 4KB page size. I have a perception that when we were installing an operating system on our hardware, the OS had read the page size of 4KB from hardware and logically divided the virtual address space into 4KB size pages and memory into frames respectively.



If my perception is true, from where or from which location in hardware does the operating system read this value of 4KB from the processor? What mechanism does the OS use to determine the page size provided by hardware? Can anybody enlighten me on this? How (On What Basis) Intel decides to keep 4KB page size.










share|improve this question
















Books on operating systems usually mentions that the page size is decided by the processor architecture, for example Intel x86 supports 4KB page size. I have a perception that when we were installing an operating system on our hardware, the OS had read the page size of 4KB from hardware and logically divided the virtual address space into 4KB size pages and memory into frames respectively.



If my perception is true, from where or from which location in hardware does the operating system read this value of 4KB from the processor? What mechanism does the OS use to determine the page size provided by hardware? Can anybody enlighten me on this? How (On What Basis) Intel decides to keep 4KB page size.







kernel memory hardware virtual-memory intel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 22 at 15:00









Stephen Kitt

169k24380458




169k24380458










asked Jan 22 at 14:41









user127956user127956

115




115













  • Wow that’s a significant edit — “how does Intel decide to keep 4KB page size?” is a rather different matter than “how does the operating system read the page size?”

    – Stephen Kitt
    Jan 22 at 14:58



















  • Wow that’s a significant edit — “how does Intel decide to keep 4KB page size?” is a rather different matter than “how does the operating system read the page size?”

    – Stephen Kitt
    Jan 22 at 14:58

















Wow that’s a significant edit — “how does Intel decide to keep 4KB page size?” is a rather different matter than “how does the operating system read the page size?”

– Stephen Kitt
Jan 22 at 14:58





Wow that’s a significant edit — “how does Intel decide to keep 4KB page size?” is a rather different matter than “how does the operating system read the page size?”

– Stephen Kitt
Jan 22 at 14:58










1 Answer
1






active

oldest

votes


















2














Operating systems hard code the page size depending on the architecture (and in some cases, build-time kernel configuration). For example, on x86 the basic page size is always 4KiB — this is a property of the CPU architecture; on Linux you’ll see this defined in include/asm/page_types. On 64-bit ARM, the page size can be configured at build-time as 4KiB, 16KiB or 64KiB. Some architectures multiple page sizes at runtime (e.g. huge pages on x86), but all the sizes are known ahead of time and the base size is fixed.



On Linux, the canonical definition of the page size is PAGE_SIZE, and you get it by including asm/page.h, which is architecture-specific (which might pull in other headers, as happens on x86). Elixir provides a handy list of all the PAGE_SIZE definitions.



Most architectures supported by the Linux kernel support 4KiB pages; the exceptions are Alpha, ARC, some Motorola 68k systems, OpenRISC and 64-bit SPARC, which all use 8KiB pages. Many architectures can be configured to use other pages sizes.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495987%2fhow-does-the-operating-system-read-the-page-size-from-hardware%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Operating systems hard code the page size depending on the architecture (and in some cases, build-time kernel configuration). For example, on x86 the basic page size is always 4KiB — this is a property of the CPU architecture; on Linux you’ll see this defined in include/asm/page_types. On 64-bit ARM, the page size can be configured at build-time as 4KiB, 16KiB or 64KiB. Some architectures multiple page sizes at runtime (e.g. huge pages on x86), but all the sizes are known ahead of time and the base size is fixed.



    On Linux, the canonical definition of the page size is PAGE_SIZE, and you get it by including asm/page.h, which is architecture-specific (which might pull in other headers, as happens on x86). Elixir provides a handy list of all the PAGE_SIZE definitions.



    Most architectures supported by the Linux kernel support 4KiB pages; the exceptions are Alpha, ARC, some Motorola 68k systems, OpenRISC and 64-bit SPARC, which all use 8KiB pages. Many architectures can be configured to use other pages sizes.






    share|improve this answer






























      2














      Operating systems hard code the page size depending on the architecture (and in some cases, build-time kernel configuration). For example, on x86 the basic page size is always 4KiB — this is a property of the CPU architecture; on Linux you’ll see this defined in include/asm/page_types. On 64-bit ARM, the page size can be configured at build-time as 4KiB, 16KiB or 64KiB. Some architectures multiple page sizes at runtime (e.g. huge pages on x86), but all the sizes are known ahead of time and the base size is fixed.



      On Linux, the canonical definition of the page size is PAGE_SIZE, and you get it by including asm/page.h, which is architecture-specific (which might pull in other headers, as happens on x86). Elixir provides a handy list of all the PAGE_SIZE definitions.



      Most architectures supported by the Linux kernel support 4KiB pages; the exceptions are Alpha, ARC, some Motorola 68k systems, OpenRISC and 64-bit SPARC, which all use 8KiB pages. Many architectures can be configured to use other pages sizes.






      share|improve this answer




























        2












        2








        2







        Operating systems hard code the page size depending on the architecture (and in some cases, build-time kernel configuration). For example, on x86 the basic page size is always 4KiB — this is a property of the CPU architecture; on Linux you’ll see this defined in include/asm/page_types. On 64-bit ARM, the page size can be configured at build-time as 4KiB, 16KiB or 64KiB. Some architectures multiple page sizes at runtime (e.g. huge pages on x86), but all the sizes are known ahead of time and the base size is fixed.



        On Linux, the canonical definition of the page size is PAGE_SIZE, and you get it by including asm/page.h, which is architecture-specific (which might pull in other headers, as happens on x86). Elixir provides a handy list of all the PAGE_SIZE definitions.



        Most architectures supported by the Linux kernel support 4KiB pages; the exceptions are Alpha, ARC, some Motorola 68k systems, OpenRISC and 64-bit SPARC, which all use 8KiB pages. Many architectures can be configured to use other pages sizes.






        share|improve this answer















        Operating systems hard code the page size depending on the architecture (and in some cases, build-time kernel configuration). For example, on x86 the basic page size is always 4KiB — this is a property of the CPU architecture; on Linux you’ll see this defined in include/asm/page_types. On 64-bit ARM, the page size can be configured at build-time as 4KiB, 16KiB or 64KiB. Some architectures multiple page sizes at runtime (e.g. huge pages on x86), but all the sizes are known ahead of time and the base size is fixed.



        On Linux, the canonical definition of the page size is PAGE_SIZE, and you get it by including asm/page.h, which is architecture-specific (which might pull in other headers, as happens on x86). Elixir provides a handy list of all the PAGE_SIZE definitions.



        Most architectures supported by the Linux kernel support 4KiB pages; the exceptions are Alpha, ARC, some Motorola 68k systems, OpenRISC and 64-bit SPARC, which all use 8KiB pages. Many architectures can be configured to use other pages sizes.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 22 at 15:42

























        answered Jan 22 at 14:52









        Stephen KittStephen Kitt

        169k24380458




        169k24380458






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495987%2fhow-does-the-operating-system-read-the-page-size-from-hardware%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?