How segmentation enables sharing of code or data?

512 views Asked by At

I read that there are segments of each process (stack segment, code segment) and each virtual address has segment number and offset this scheme allows code sharing between processes. I didn't understand the idea of sharing please explain the sharing with an example ?

1

There are 1 answers

0
user3344003 On

What you are describing is largely obsolete. The use of segments was a kludge in the early intel processors that needlessly lived on for decades. Segments go away with 64 bit intel.The segment is usually specified using a register, not as part of the address.

As to your question, in theory multiple processes could share the same same code segment. However, this is easier said than done because a process's code [segment] is usually loaded from multiple sources.