[SOLVED] Strange Windows API function

Programming, for all ages and all languages.
Post Reply
Rukog
Member
Member
Posts: 51
Joined: Sun Aug 01, 2021 5:24 pm

[SOLVED] Strange Windows API function

Post by Rukog »

While coding in C# I found this strange looking function
https://docs.microsoft.com/en-us/dotnet ... empagesize

It returns the page size in bytes from paging mechanism.

Ive printed its value and it shows me 4096-Byte.
Does it mean this value can be different among 4-KByte Page 2-MByte Page and 1-GByte Page ?

It's strange that user level can get a such kernel related information.
Last edited by Rukog on Thu Sep 09, 2021 12:47 pm, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Strange Windows API function

Post by Octocontrabass »

Windows NT was originally written to run on several different non-x86 platforms, and some of them did not support 4kiB pages.

Userspace needs to know the page size because memory management operates at page granularity.
Post Reply