envoi
This commit is contained in:
commit
f2bb325213
0
ASR3.1/TP01/[200~sum_array.c~
Normal file
0
ASR3.1/TP01/[200~sum_array.c~
Normal file
BIN
ASR3.1/TP01/a.out
Executable file
BIN
ASR3.1/TP01/a.out
Executable file
Binary file not shown.
27
ASR3.1/TP01/adresses_virtuelles.c
Normal file
27
ASR3.1/TP01/adresses_virtuelles.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* adresses virtuelles d'un processus */
|
||||||
|
|
||||||
|
#include<stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
int t[1000] = {[0 ... 999] = 2};
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
int i=3;
|
||||||
|
static int j = 3;
|
||||||
|
char * m = (char*)malloc(1);
|
||||||
|
|
||||||
|
printf("je suis le pid %d\n\n",getpid());
|
||||||
|
|
||||||
|
/* ------- Affichage des adresses --------*/
|
||||||
|
|
||||||
|
printf("main\t=\t%p\n",main);
|
||||||
|
printf("&argc\t=\t%p\n",&argc);
|
||||||
|
printf("&i\t=\t%p\n",&i);
|
||||||
|
printf("&j\t=\t%p\n",&j);
|
||||||
|
printf("t\t=\t%p\n",t);
|
||||||
|
printf("m\t=\t%p\n",m);
|
||||||
|
|
||||||
|
getchar();
|
||||||
|
}
|
8
ASR3.1/TP01/bss_data.c
Normal file
8
ASR3.1/TP01/bss_data.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* segment bss et data */
|
||||||
|
#define N 100000
|
||||||
|
//int t[N]; /* version 1 */ //La mémoire augmente bss
|
||||||
|
int t[N]={1}; /* version 2 */ //La mémoire reste inchangée bss
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
26
ASR3.1/TP01/exercice3.c
Normal file
26
ASR3.1/TP01/exercice3.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/* accès mémoire */
|
||||||
|
#include<stdio.h>
|
||||||
|
#include<time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#define N 8192
|
||||||
|
|
||||||
|
int t[N][N];
|
||||||
|
|
||||||
|
static inline double tstamp(void)
|
||||||
|
{
|
||||||
|
struct timespec tv;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &tv);
|
||||||
|
return tv.tv_sec + tv.tv_nsec * 1.0e-9;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
double t1,t2;
|
||||||
|
t1=tstamp();
|
||||||
|
/* version 1 */ for(i=0;i<N;i++) for(j=0;j<N;j++) t[i][j] = 1;
|
||||||
|
/* version 2 */ // for(i=0;i<N;i++) for(j=0;j<N;j++) t[j][i] = 1; //parcours en colonne. défaut de cache donc plus long.
|
||||||
|
t2=tstamp();
|
||||||
|
printf("time = %lf\n",t2-t1);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user