Question: Q 2 . Write a program that simulates an operating system's memory management using segmentation. Your task is to simulate the process of translating logical

Q2. Write a program that simulates an operating system's memory management using
segmentation. Your task is to simulate the process of translating logical addresses to
physical addresses using the concept of segmentation. Additionally, you will simulate
conditions where a segmentation fault occurs. Add your assumptions, if any, to a
ReadMe file. [20 pts]
Design:
The system has three segments: Code, Heap, and Stack.
Each segment has a base and a limit (bounds), which define where the segment
starts in memory and its length.
Assume the system has a 64KB physical memory, and memory is reserved as
follows:
Code Segment: Starts at 32KB, size 2KB.
Heap Segment: Starts at 34KB, size 3KB.
Stack Segment: Starts at 28KB and grows downwards, size 2KB.
A segmentation fault should be raised if the offset exceeds the segment's limit.
Use the pseudocode from Chapter 16 for the address translation.
Input: The user can enter a 16-bit logical address in hex format. For example: a56f
Output: 16-bit physical address in hex format or segmentation fault. solve

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!