0% found this document useful (0 votes)
112 views6 pages

Segmentation and Addressing Errors

Segmentation divides memory into segments and uses a segment table to map logical addresses to physical addresses. The question asks which logical address would produce a trap error. Option C (2, 100) would produce a trap since the segment offset of 100 exceeds the limit of 99 for segment 2. Option C is the only logical address that violates the segment offset limit.

Uploaded by

subhasis mitra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views6 pages

Segmentation and Addressing Errors

Segmentation divides memory into segments and uses a segment table to map logical addresses to physical addresses. The question asks which logical address would produce a trap error. Option C (2, 100) would produce a trap since the segment offset of 100 exceeds the limit of 99 for segment 2. Option C is the only logical address that violates the segment offset limit.

Uploaded by

subhasis mitra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Segmentation:-

 Like Paging, Segmentation is another non-contiguous memory


allocation technique.
 Segmentation divides the process into meaningful segments.
 Segment table stores the information about each segment of the
process.
PRACTICE PROBLEM BASED ON SEGMENTATION-

Problem-

Consider the following segment table-

Segment
Base Length
No.

0 1219 700

1 2300 14

2 90 100

3 1327 580

4 1952 96
Which of the following logical address will produce trap addressing
error?
1. 0, 430
2. 1, 11
3. 2, 100
4. 3, 425
5. 4, 95

Calculate the physical address if no trap is produced.

Solution-

In a segmentation scheme, the generated logical address consists of


two parts-
1. Segment Number
2. Segment Offset

We know-
 Segment Offset must always lie in the range [0, limit-1].
 If segment offset becomes greater than or equal to the limit of
segment, then trap addressing error is produced.

Option-A: 0, 430-

Here,
 Segment Number = 0
 Segment Offset = 430

We have,
 In the segment table, limit of segment-0 is 700.
 Thus, segment offset must always lie in the range = [0, 700-1] = [0,
699]

Now,
 Since generated segment offset lies in the above range, so request
generated is valid.
 Therefore, no trap will be produced.
 Physical Address = 1219 + 430 = 1649

Option-B: 1, 11-

Here,
 Segment Number = 1
 Segment Offset = 11

We have,
 In the segment table, limit of segment-1 is 14.
 Thus, segment offset must always lie in the range = [0, 14-1] = [0,
13]
Now,
 Since generated segment offset lies in the above range, so request
generated is valid.
 Therefore, no trap will be produced.
 Physical Address = 2300 + 11 = 2311

Option-C: 2, 100-

Here,
 Segment Number = 2
 Segment Offset = 100

We have,
 In the segment table, limit of segment-2 is 100.
 Thus, segment offset must always lie in the range = [0, 100-1] = [0,
99]

Now,
 Since generated segment offset does not lie in the above range, so
request generated is invalid.
 Therefore, trap will be produced.

Option-D: 3, 425-

Here,
 Segment Number = 3
 Segment Offset = 425

e have,
 In the segment table, limit of segment-3 is 580.
 Thus, segment offset must always lie in the range = [0, 580-1] = [0,
579]

Now,
 Since generated segment offset lies in the above range, so request
generated is valid.
 Therefore, no trap will be produced.
 Physical Address = 1327 + 425 = 1752

Option-E: 4, 95-

Here,
 Segment Number = 4
 Segment Offset = 95

We have,
 In the segment table, limit of segment-4 is 96.
 Thus, segment offset must always lie in the range = [0, 96-1] = [0,
95]

Now,
 Since generated segment offset lies in the above range, so request
generated is valid.
 Therefore, no trap will be produced.
 Physical Address = 1952 + 95 = 2047
Thus, Option-(C) is correct.

You might also like