this question, assume you implemented and then compiled a code into a binary file mycode. Then You launch t Bram mycode, It becomes a process and has a pid now. While the program is running, we can see informatic about the process in the directory /proc/pid. If we go to that directory and look at to the content of the file map we see information about the virtual memory usage of the process. Below is such an output for program myco (in my system it has a pid=18854). In 'maps' file, each line of the output gives information about an address range in the virtual memory. The numbers are in hexadecimal, For example, the address range bf88a000-bf8ab000 contains the stack. The address range 08538000-0855b000 contains the heap. This program was executed on a 32-bit machine and virtual addresses are 3 bits. It is an Intel machine applying two level hierarchical paging. Address division scheme is: 10-10-12. Hence the Page size is 4 KB. #include, sinclude #include, void funl)( shact, a- 10; slecp(1000); iat, main(yoid) Drántf("Process pid is Xld \n", (long)Estrid()); Scand(time(@)); Printf("My candon ounber. is Xd\0); forlint i-e;i

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
this question, assume you implemented and then compiled a code into a binary file mycode. Then you launch the
gram mycode, It becomes a process and has a pid now. While the program is running, we can see information
about the process in the directory /proc/pid. If we go to that directory and look at to the content of the file maps,
we see information about the virtual memory usage of the process. Below is such an output for program mycode
(in my system it has a pid=18854).
In 'maps' file, each line of the output gives information about an address range in the virtual memory. The numbers
are in hexadecimal. For example, the address range bf88a000-bf8ab000 contains the stack. The address range
08538000-0855b000 contains the heap. This program was executed on a 32-bit machine and virtual addresses are 32
bits. It is an Intel machine applying two level hierarchical paging. Address division scheme is: 10-10-12. Hence the
Page size is 4 KB.
#jaclude <stdiank
#inslude <uaistd
#include <sxs/tuRes.k>
#include, <stdlibuks
void fun(){
shact, a - 10;
sleep(1000);
iat, main(yQid)
{
Drintf("Precess pid is Xld \n", (1ong)gstrid());
SCand(time (0));
Brintf("Hy candon DUmber, is %d\o);
forlint i-0;i<ciÂ+){
iot r = cand()X1000;
iat "k = (int")wallos(100*sizeaf(int));
funl);
cetuco, e;
a) Which memory layout is used in your OS (Is it 32 bits or 64 bits?)
b) How many levels are used in the memory layout?
b) What is the size of the heap in your process at the moment?
c) What is the size of the stack in your process at the moment?
d) What is the total amount of virtual memory used by this process at the moment?
e) How many second level page tables are needed by this process at the moment?
f) How much memory space is needed to store page tables (including first & second level tables) at the moment?
(Assume each entry in page tables is 4 byte)
Transcribed Image Text:this question, assume you implemented and then compiled a code into a binary file mycode. Then you launch the gram mycode, It becomes a process and has a pid now. While the program is running, we can see information about the process in the directory /proc/pid. If we go to that directory and look at to the content of the file maps, we see information about the virtual memory usage of the process. Below is such an output for program mycode (in my system it has a pid=18854). In 'maps' file, each line of the output gives information about an address range in the virtual memory. The numbers are in hexadecimal. For example, the address range bf88a000-bf8ab000 contains the stack. The address range 08538000-0855b000 contains the heap. This program was executed on a 32-bit machine and virtual addresses are 32 bits. It is an Intel machine applying two level hierarchical paging. Address division scheme is: 10-10-12. Hence the Page size is 4 KB. #jaclude <stdiank #inslude <uaistd #include <sxs/tuRes.k> #include, <stdlibuks void fun(){ shact, a - 10; sleep(1000); iat, main(yQid) { Drintf("Precess pid is Xld \n", (1ong)gstrid()); SCand(time (0)); Brintf("Hy candon DUmber, is %d\o); forlint i-0;i<ciÂ+){ iot r = cand()X1000; iat "k = (int")wallos(100*sizeaf(int)); funl); cetuco, e; a) Which memory layout is used in your OS (Is it 32 bits or 64 bits?) b) How many levels are used in the memory layout? b) What is the size of the heap in your process at the moment? c) What is the size of the stack in your process at the moment? d) What is the total amount of virtual memory used by this process at the moment? e) How many second level page tables are needed by this process at the moment? f) How much memory space is needed to store page tables (including first & second level tables) at the moment? (Assume each entry in page tables is 4 byte)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY