What is meant by dividing a process into pages in the concrete sense? [closed]
Asked Answered
P

1

6

The way I understand the notion of a 'process' is that it is a running instance of an executable program.The exe is in the secondary memory and the running instance of it is in the RAM. If this understanding is right, I would like to know what is really meant by this abstract description: 'Dividing a process into 'pages' and running some of the pages in RAM and keeping the rest in secondary memory for swapping when needed'? The question here is in the context of virtual memory.

Adding a 'programming' context to the question, following suggestions from moderators:

Say I write a small program to list the numbers from 1 to 100 (or) to print 'Hello world' (or) some desktop utility to scan a text file and print the words in the file one by one within the desktop window. Considering the final executable I have, once these programs are compiled and linked, how can the executable be 'divided' and run in parts in RAM when I run the executable? How shall I grasp and visualise the idea of what 'should be' in RAM at a point in time and what 'should not'?

Precis answered 17/2, 2013 at 7:21 Comment(2)
It's a pretty interesting question. Wonder why it was closed by SO. Could this question be reopened? It seems relevant from the standpoint of understanding fundamentals of programming.Stubblefield
Thanks Chandan. I would be glad if it is re-openedPrecis
J
0

You have it (the division) right there, in the virtual to physical address translation. The virtual address space is split into blocks of one or several kilobytes (typically, all of the same size), each of which can be associated with a chunk (page) of physical memory of the same size.

Those parts of the executable (or process) that haven't been used yet or haven't been used recently need not to be copied into the physical memory from the disk and so the respective portions of the virtual address space may not be associated with physical memory either. When the system becomes low on free physical memory, it may repurpose some pages, saving their contents to the disk if necessary (or not saving, if they contain read-only data/code).

Jessjessa answered 17/2, 2013 at 8:53 Comment(3)
Thanks Alexey. I have added some more info to my question now for your reply.Precis
Learn about page tables.Jessjessa
Alexey - I did already before posting the question. In the examples presented by me, I want you to imagine the actual machine instructions inside the exe file and then tell me how those instructions would be segregated for keeping some in RAM and some in secondary memory. Which is why I would like a concrete answer and not one in the abstract sensePrecis

© 2022 - 2024 — McMap. All rights reserved.