Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding SC_PAGE_SIZE using Python in Windows

I'm working in this mixed environment where I'm on a Windows machine using Simics and Cygwin to run some code in a unix like environment. I've been coding in C but I'm interested in trying to do my solution in Python. In the unix environment to find the SC_PAGE_SIZE you can simply do:

#Python-2.7, unix environment
page_size = os.sysconf("SC_PAGE_SIZE")

If you're coding in c you can do:

#C, unix environment
size_t page_size = (size_t) sysconf (_SC_PAGESIZE);

However when using python in Windows os.sysconf doesn't exist and I've been unable to find a replacement. What can I use in python to find the PAGE_SIZE of the environment.

A side note, I know you may wonder why I'm using the setup as it is and it's not my choice. It's an homework assignment from work. The question I'm asking is for my own benefit it's not for the homework.

like image 294
Tyler Ferraro Avatar asked Dec 22 '22 03:12

Tyler Ferraro


1 Answers

Try:

import mmap

print mmap.PAGESIZE
like image 70
Aaditya Kalsi Avatar answered Jan 09 '23 20:01

Aaditya Kalsi