0% found this document useful (0 votes)
2 views

Ex08

The document presents a series of problems related to memory allocation and address translation in computer systems. It includes calculations for physical addresses based on base and limit registers, paging systems, and segment tables, detailing both valid and invalid references. Each problem provides specific examples with corresponding calculations for logical and physical addresses.

Uploaded by

quyendz767
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Ex08

The document presents a series of problems related to memory allocation and address translation in computer systems. It includes calculations for physical addresses based on base and limit registers, paging systems, and segment tables, detailing both valid and invalid references. Each problem provides specific examples with corresponding calculations for logical and physical addresses.

Uploaded by

quyendz767
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Problem 1

Given a contiguous memory allocation system, suppose a process has the base and
limit registers with
the corresponding values of (18680, 1260). Calculate the physical address of the
following references:

12,-26,678, 1272

12 -> physical address = 18680 + 12 = 18692


-26 -> Invalid reference (-26 is negative), the address is outside the range of the
process
678 -> physical address = 18680 + 678 = 19358
1272 -> Invalid reference (1272 is greater than the limit of 1260), the address is
outside the range of the process

Problem 2
Suppose the page size is 1KB in a (1-level) paging system. A proces has the size of
157 KB, calculate
(page, offset) of the following logical address: 78, 1346, 8184, 126868, 183242

pages = 157KB / 1KB = 157

78 -> page = 78 / 1024 = 0, offset = 78 % 1024 = 78


1346 -> page = 1346 / 1024 = 1, offset = 1346 % 1024 = 322
8184 -> page = 8184 / 1024 = 7, offset = 8184 % 1024 = 1016
126868 -> page = 126868 / 1024 = 123, offset = 126868 % 1024 = 916
183242 -> page = 183242 / 1024 = 178, Invalid reference (178 is greater than the
number of pages, 157)

Problem 3
Given the page table of a process (16, 92, 3, 87). Suppose the page size is 1KB in
a (1-level) paging
system, calculate the physical address of the following reference: 124, 8672, 3246,
4782,

- first we calculate logical address then we transform it to physical address

124 -> page = 124 / 1024 = 0, offset = 124 % 1024 = 124 -> physical address = 16 *
1024 + 124 = 16508
8672 -> page = 8672 / 1024 = 8, Invalid reference (8 is greater than the number of
pages, 3)
3246 -> page = 3246 / 1024 = 3, offset = 3246 % 1024 = 174 -> physical address = 87
* 1024 + 174 = 89262
4782 -> page = 4782 / 1024 = 4, Invalid reference (4 is greater than the number of
pages, 3)

Problem 4

Given a paging system with the page size of 2KB in a (1-level) paging system. The
address register is 32
bit. Identify the number of bits for (page, offset) in the address register.

page size = 2KB = 2048 bytes = 2^11 bytes -> 11 bits for offset

32 - 11 = 21 bits for page

(page, offset) = (21, 11)


Problem 5

Given a paging system with the page size of 4KB in a (1-level) paging system. The
address register is 42
bit. Identify the number of bits for (page, offset) in the address register.

page size = 4KB = 4096 bytes = 2^12 bytes -> 12 bits for offset

42 - 12 = 30 bits for page

(page, offset) = (30, 12)

Problem 6

Given the page table of a process in the form of (frame, valid) [(16, v), (92, i),
(3, v), (87, v)] in a (1-level)
paging system. Suppose the page size is 1KB, calculate the physical address of the
following reference:
124, 8672, 3246, 4782,

124 -> page = 124 / 1024 = 0, offset = 124 % 1024 = 124, valid -> physical address
= 16 * 1024 + 124 = 16508
8672 -> page = 8672 / 1024 = 8 -> invalid reference
3246 -> page = 3246 / 1024 = 3, offset = 3246 % 1024 = 174, valid -> physical
address = 87 * 1024 + 174 = 89262
4782 -> page = 4782 / 1024 = 4 -> invalid reference

Problem 7

Given the page table containing the page-frame mapping [16, 92, 3, 87, 723].
Suppose the page size is
1KB in a (1-level) paging system, calculate the physical address of the following
reference: 124, 8672,
3246, 4782,

124 -> page = 124 / 1024 = 0, offset = 124 % 1024 = 124 -> physical address = 16 *
1024 + 124 = 16508
8672 -> page = 8672 / 1024 = 8, invalid reference
3246 -> page = 3246 / 1024 = 3, offset = 3246 % 1024 = 174 -> physical address = 87
* 1024 + 174 = 89262
4782 -> page = 4782 / 1024 = 4, offset = 4782 % 1024 = 686 -> physical address =
723 * 1024 + 686 = 741038

Problem 8
Given the segment table of a process in the form of (base, limit) [(16000, 1200),
(18000, 4700), (28900,
200)]. Calculate the physical address of the following reference in the form of
(segment, offset): (0, 868),
(0, 124), (1, 900), (2, 86)

(0, 868) -> segment = 0, offset = 868 -> physical address = 16000 + 868 = 16868
(0, 124) -> segment = 0, offset = 124 -> physical address = 16000 + 124 = 16124
(1, 900) -> segment = 1, offset = 900 -> physical address = 18000 + 900 = 18900
(2, 86) -> segment = 2, offset = 86 -> physical address = 28900 + 86 = 28986

Problem 9
Given the segment table of a process in the form of (base, limit, valid) [(16000,
1200, v), (18000, 4700, i),
(28900, 2100, v)]. Calculate the physical address of the following reference in the
form of (segment,
offset): (0, 868), (0, 124), (1, 900), (2, 86)

(0, 868) -> segment = 0, offset = 868 , valid -> physical address = 16000 + 868 =
16868
(0, 124) -> segment = 0, offset = 124 , valid -> physical address = 16000 + 124 =
16124
(1, 900) -> segment = 1, offset = 900 , invalid -> invalid reference
(2, 86) -> segment = 2, offset = 86 , valid -> physical address = 28900 + 86 =
28986

You might also like