TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

OS Finding Optimal Page Size

OS Finding Optimal Page Size with Definition and functions, OS Tutorial, Types of OS, Process Management Introduction, Attributes of a Process, Process Schedulers, CPU Scheduling, SJF Scheduling, FCFS with overhead, FCFS Scheduling etc.

<< Back to OS

Finding Optimal Page Size

We have seen that the bigger page table size cause an extra overhead because we have to divide that table into the pages and then store that into the main memory.

Our concern must be about executing processes not on the execution of page table. Page table provides a support for the execution of the process. The larger the page Table, the higher the overhead.

We know that,

Page Table Size = number of page entries in page table X size of one page entry 
Let's consider an example, 
Virtual Address Space = 2 GB = 2 X 2 ^ 30 Bytes 
Page Size = 2 KB = 2 X 2 ^ 10 Bytes 
Number of Pages in Page Table = (2 X 2 ^ 30)/(2 X 2 ^ 10) = 1 M pages 

There will be 1 million pages which is quite big number. However, try to make page size larger, say 2 MB.

Then, Number of pages in page table = (2 X 2 ^ 30)/(2 X 2 ^ 20) = 1 K pages.

If we compare the two scenarios, we can find out that the page table size is anti proportional to Page Size.

In Paging, there is always wastage on the last page. If the virtual address space is not a multiple of page size, then there will be some bytes remaining and we have to assign a full page to those many bytes. This is simply a overhead.

Let's consider,

Page Size = 2 KB 
Virtual Address Space = 17 KB
Then number of pages = 17 KB / 2 KB 

The number of pages will be 9 although the 9th page will only contain 1 byte and the remaining page will be wasted.

In general,

If page size = p bytes 
Entry size = e bytes 
Virtual Address Space = S bytes 
Then, overhead O = (S/p) X e + (p/2) 

On an average, the wasted number of pages in a virtual space is p/2(the half of total number of pages).

For, the minimal overhead,

∂O/∂p = 0 
-S/(p^2) + ½ = 0
p = √ (2.S.e) bytes 

Hence, if the page size √(2.S.e) bytes then the overhead will be minimal.


Next TopicVirtual Memory




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf