Closed

C+ Programming, Operating System and Memory Table

1. The ultimate aim of this question is to find out how your Unix system layouts different parts of your process in the virtual memory. The question consists of three parts. The first part is to complete a program that prints out the memory addresses of various components of the process (eg, global variables, local variables, dynamically allocated variables, functions, command line arguments, and environment variables). This program is then used in the second part to recreate a snapshot of the memory layout of the process. Finally in the third, you will answer a number of questions related to the memory management based on your observation and analysis.

Complete the following C program, memory.c, so that it displays the addresses of

functions f1, f2, and main;

all string literals such as "Hello, world!";

all initialized global variables;

all un-initialized global variables;

all dynamically allocated memories;

all formal parameters in functions;

all local variables;

start and end of its command line arguments;

start and end of its environment (variables and values)

2. Based on the information generated from the above program, produce a memory map table showing the layout of literals, initialised global variables, uninitialised global variables, formal parameters of each function, local variables, dynamically allocated variables, functions, environment and command line arguments in the memory when the program runs at label L in function f2.

The memory map table must show the addresses of each variable, literal, and function and their sizes. It should also show the start and end addresses of the environment and the command line arguments and their sizes.

The memory map table must contain at least the following columns:

The start address of an entity such as a variable or a function

The length of the storage space of the entity in bytes

The name of the entity, such as global_pointer1 or Hello, world!

The nature of the entity, such as function, or uninitialsed global variable

The memory section, eg, environment, command line arguments, code (or text), global initialised data, global uninitialed data, stack, heap etc.

In addition, you must use seven different background colours to highlight the following seven memory sections as indicated below::

[Green] initialised global variables (including constants and literals)

[Red] uninitialised global variables

[Blue] stack (containing the local variables and returning addresses of function calls)

[Magenta] heap (containing the dynamically allocated memories)

[Yellow] code (functions)

[Cyan] process environment

[White] command line arguments

Please also note that in your memory table, the memory addresses must be strictly sequential, from the lowest address to the highest address to reflect how different components of a running program are layout in the virtual memory. Your memory table will not be accepted if the addresses are not lined up sequentially in the table. If you find that components from one section are split in more than one continuous area of memory, it is a sure indication that there is something wrong with your memory map and you should find out what went wrong and fix it.

3. Based on the experiment and analysis you have carried out in 1 and 2 above, answer the following questions:

What is the size of the virtual address space of that process?

How does the operating system on your machine layouts the following process components in the virtual address space: command line arguments, environment, literals, initialised global variables, uninitialised global variables, functions, formal parameters and local variables of a function, and dynamically allocated variables (or memories)?

Skills: C Programming, C++ Programming, Linux, Software Architecture, UNIX

See more: memory management in c++, memory manager c++, c program for segmentation in os, write a c program to implement memory management using segmentation, virtual memory implementation in c, virtual memory program in c, dynamic memory allocation in c++ with example program, custom memory manager c++, C Programming in Embedded System , food order management system in c programming, College management system source code in c programming language, student rigestration system in c++ programming, c++ programming table of weights year of birth, need help in c programming, https://wwwfreelancercom/projects/c-programming/system-monitor-the-temperature-the/

About the Employer:
( 0 reviews ) Singapore

Project ID: #17159926

8 freelancers are bidding on average $75 for this job

hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 7 years. My work is online game developing, and mainly focus on server side, using c++ under Linux environ More

$250 SGD in 3 days
(141 Reviews)
7.0
xinglong717

How are you? i can help you and i will help you continuously in the future i am C# C language expert. I have much experiences in building wallet with Qt on Mac, Linux and Windows. I am interested in your project. More

$100 SGD in 1 day
(19 Reviews)
4.7
$100 SGD in 3 days
(37 Reviews)
4.8
rupaneeraj

Hello dear Hiring manager I have read your job post & being an expert Web developer, I offer myself for the job. I am having extensive knowledge and 5+ years of experience in PHP & WordPress website development u More

$27 SGD in 1 day
(1 Review)
0.0
WiseCoderMonkey

hi...by when do you need it completed? thanks :)

$51 SGD in 3 days
(0 Reviews)
0.0
omkarjpathak

Over 8 years of software development experience across various domains. Primary skills include C/C++ on Windows as well as Linux platform. Good at shell scripting. Expert in debugging.

$27 SGD in 1 day
(0 Reviews)
1.1
$16 SGD in 1 day
(0 Reviews)
0.0
akankshapal

I have worked in research organisations and feeling extremely comfortable in the C programming, Data Structures and Operating System concepts. I have worked in this area for last 3 -4 years. You can trust on me as its More

$27 SGD in 3 days
(0 Reviews)
0.0