During swap in time does only the data segment of the process gets changed or even the text segment of the process may also change?
since text segment of the process will also sit at some address as explained here:
1000: mov accm, 
1010: add accm,
1020: mov , accm
The swapper actually does not distinguish whether a page is of text or is of data. The swapping takes place in chunks of pages. Only some of the pages of a process may get swapped out depending upon the need for new physical pages and last access times of the pages. I have presented a very simplified view of the swapping since the entire swapping mechanism is very difficult to grasp in its entirety. For those who wish to actually deal with UNIX source code, a further study will be required whether it is Process management OR Memory management OR File management.
Please login first to submit.