Search code examples
operating-systemradixsegmentsregister-allocation

Segment Table Calculations


I have a question. I "Googled" it many times but could not find the solution or any method to solve it.

On a system using simple segmentation, the segment table is as follows (All values are in decimal):

| Segment | Base Register Value | Limit Register Value |
|---------|---------------------|----------------------|
| 0       | 3000                | 1024                 |
| 1       | 8192                | 1208                 |
| 2       | 1000                | 1200                 |
| 3       | 5000                | 2048                 |

a) Draw a memory allocation chart showing all segments.

b) Compute the physical addresses corresponding to the following segment+offset logical addresses (if the address generates a fault, indicate): 0+1200, 1+500, 3+1024.

c) Compute the logical segment+offset addresses corresponding to the following physical addresses (if the address generates a fault, indicate): 9000, 50, 1200.


Solution

  • Here are the answers; I think you will understand by taking a careful look at them:

    a)

    | Main Memory |              |
    |-------------|--------------|
    | 0           |              |
    |             | Segment 2    |
    | 1000        |              |
    |             | unallocated  |
    | 2200        |              |
    |             | unallocated  |
    | 3000        |              |
    |             | Segment 0    |
    | 4024        |              |
    |             | unallocated  |
    | 5000        |              |
    |             | Segment 3    |
    | 7048        |              |
    |             | unallocated  |
    | 8192        |              |
    |             | Segment 1    |
    | 9208        |              |
    | ...         | unallocated  |
    

    b) 0+1200 --> 4200, 1+500 --> 8692, 3+1024 --> 6024.

    c) 9000 --> 1+808, 50 --> fault, 1200 --> 2+200.