Demand Segmentation

Q1. Explain Demand Segmentation.

Ans. Operating system also uses demand segmentation, which is similar to demand paging. Operating system to uses demand segmentation where there is insufficient hardware available to implement ‘Demand Paging’.

The segment table has a valid bit to specify if the segment is already in physical memory or not. If a segment is not in physical memory then segment fault results, which traps to the operating system and brings the needed segment into physical memory, much like a page fault.

Demand segmentation allows for pages that are often referenced with each other to be brought into memory together, this decreases the number of page faults.

Another space server would be to keep some of a segment’s page tables on disk and swap them into memory when needed.

 

Sharing of Memory

Q3. Explain Sharing of Memory.

Ans. Each process has a segment table associated with it, which the dispatcher uses to define the hardware segment table when this process is given the CPU. Segments are shared when entries in the segment table of two different processes point to the same physical location.

Sharing

Figure: Sharing of Memory

P1

Segment Limit Base
0 1000 1400
1 400 2400

 

P2

Segment Limit Base
0 1000 1400
1 400 4300

Physical Memory

Figure: Physical Memory