Skip to content
Snippets Groups Projects
Commit 97a7d06e authored by Antoine's avatar Antoine
Browse files

Small fixes T2 et T3.

parent debc6cba
No related merge requests found
# Task 2 - Explain the difference between virtual and physical memory for this exercise
Physical memory is the real set of addresses in the memory of a computer. Virtual memory is a set of addresses that translate to physical addresses. The virtual memory is the view of a program of the memory, which makes the program feel like it's the only one running on the CPU since the virtual addresses of each program starts at 0.
\ No newline at end of file
Physical memory is the real set of addresses in the memory of a computer. Virtual memory is a set of addresses that translates to physical addresses through calculations based on the base and limit registers values of each program and calculated by the MMU.
The virtual memory is the view of a program of the memory, which makes the program feel like it's the only one running on the CPU since the virtual addresses of each program starts at 0.
In Task 1, we had programs that may have tried to access zones outside of their virtual memory, which can explain the segmentation faults. It could also be that the accessed zones are read-only zones inside the virtual memory of the program, such as the text segment.
\ No newline at end of file
......@@ -12,7 +12,7 @@ int readLinesCount(const char * str) {
int fd = open(str, O_RDONLY);
if (fd < 0) {
perror("Open error");
exit(-1);
exit(EXIT_FAILURE);
}
int n;
......@@ -33,7 +33,7 @@ void writeLinesCount(const char * str, int count_line) {
int fd = open(str, O_CREAT | O_WRONLY | O_APPEND, 0666);
if (fd < 0) {
perror("Open error");
exit(-1);
exit(EXIT_FAILURE);
}
char cline_str[MAX_LINE_STR];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment