void linux_survey_TT(char *)
to your Linux kernel so that you can
call it in your program. The system call has the following properties.
void linux_survey_TT()
.
test.c
as follows to collect the information you need.
Execute this program after your start all required programs.
#include <stdio.h>
#include <unistd.h>
#define MEMORY_SIZE 1000000
main()
{
int result_1[MEMORY_SIZE];
int result_2[MEMORY_SIZE];
int result_3[MEMORY_SIZE];
int exit_status;
: // Definition of other varialbes you need to use in your program
: // Your initialization code
if(fork())
{ //executed by the parent process
linux_survey_TT(result_1); //location 1
wait(&exit_status);
: // Code to write the final results in array result_1[] to a file, such as result_1.txt
// for further analysis.
}
else
{ //executed by the child process
linux_survey_TT(result_2); //location 2
result_1[0]=123; //This should trigger copy-on-right, if the above system call does not trigger the COW.
linux_survey_TT(result_3); //location 3
: // Code to write the final results in array result_2[] to a file, such as result_2.txt
: // for further analysis.
: // Code to write the final results in array result_3[] to a file, such as result_3.txt
: // for further analysis.
}
}
void linux_survey_TT()
at location 1 of
the parent process, and location 2 and location 3 of the child process,
list the corresponding physical address intervals used by the above virtual address intervals at the moment that you
execute system call void linux_survey_TT()
. (20 points)
result_1.txt
,
result_2.txt
, and result_3.txt
,
show the virtual address space intervals of
the child process that map to the same physical address space intervals of the parent process at location 2 and location 3 of the child process.
(15 points)