TD3 II.3+4 stress test our implementation
This commit is contained in:
parent
dcb11cf311
commit
4a67b57492
12 changed files with 95 additions and 13 deletions
|
@ -41,8 +41,8 @@ CFLAGS += -fsanitize=undefined
|
|||
LDFLAGS += -fsanitize=undefined
|
||||
|
||||
# décommenté TD1 - partie V
|
||||
CFLAGS += -fsanitize=address
|
||||
LDFLAGS += -fsanitize=address -lpthread
|
||||
#CFLAGS += -fsanitize=address
|
||||
#LDFLAGS += -fsanitize=address -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(NACHOS_SYS),MAC_OS_SYS)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
// the disk sector size, for
|
||||
// simplicity
|
||||
|
||||
#define NumPhysPages 128 // Increase this as necessary!
|
||||
#define NumPhysPages 1024 // Increase this as necessary!
|
||||
#define MemorySize (NumPhysPages * PageSize)
|
||||
#define TLBSize 4 // if there is a TLB, make it small
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ main()
|
|||
{
|
||||
ForkExec("../test/userpages0");
|
||||
ForkExec("../test/userpages0");
|
||||
while(1);
|
||||
// while(1);
|
||||
ThreadExit();
|
||||
}
|
||||
|
||||
|
|
18
code/test/forkexec_stress.c
Normal file
18
code/test/forkexec_stress.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "syscall.h"
|
||||
|
||||
const int process = 12;
|
||||
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<process;i++){
|
||||
int c = i % 2;
|
||||
if ( c==0)
|
||||
ForkExec("../test/userpages0_stress");
|
||||
else
|
||||
ForkExec("../test/userpages1_stress");
|
||||
}
|
||||
ThreadExit();
|
||||
// while(1);
|
||||
}
|
||||
|
|
@ -14,11 +14,11 @@ void f(int c) {
|
|||
|
||||
int main(){
|
||||
int i;
|
||||
for (i=65; i < 98; i++){
|
||||
for (i=90; i < 98; i++){
|
||||
ThreadCreate(f, i);
|
||||
}
|
||||
// PutString("end of main()\n");
|
||||
ThreadExit();
|
||||
//ThreadExit();
|
||||
//return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@ int main () {
|
|||
void* f = output;
|
||||
|
||||
ThreadCreate(f,"a");
|
||||
ThreadCreate(f,"b");
|
||||
ThreadCreate(f,"a");
|
||||
PutString("\nthis is the end of our main() in test program\n");
|
||||
ThreadExit();
|
||||
}
|
||||
|
|
21
code/test/userpages0_stress.c
Normal file
21
code/test/userpages0_stress.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "syscall.h"
|
||||
const int t = 13;
|
||||
|
||||
void output(char* s) {
|
||||
int nb = 10;
|
||||
int i;
|
||||
for(i=0;i<nb;i++)
|
||||
PutString((char*)s);
|
||||
ThreadExit();
|
||||
}
|
||||
|
||||
int main () {
|
||||
|
||||
void* f = output;
|
||||
int i;
|
||||
for (i=0;i<t;i++){
|
||||
ThreadCreate(f,"b");
|
||||
}
|
||||
PutString("\nthis is the end of our main() in test program\n");
|
||||
ThreadExit();
|
||||
}
|
21
code/test/userpages1_stress.c
Normal file
21
code/test/userpages1_stress.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "syscall.h"
|
||||
const int t = 13;
|
||||
|
||||
void output(char* s) {
|
||||
int nb = 10;
|
||||
int i;
|
||||
for(i=0;i<nb;i++)
|
||||
PutString((char*)s);
|
||||
ThreadExit();
|
||||
}
|
||||
|
||||
int main () {
|
||||
|
||||
void* f = output;
|
||||
int i;
|
||||
for (i=0;i<t;i++){
|
||||
ThreadCreate(f,"a");
|
||||
}
|
||||
PutString("\nthis is the end of our main() in test program\n");
|
||||
ThreadExit();
|
||||
}
|
|
@ -171,7 +171,7 @@ AddrSpace::AddrSpace (OpenFile * executable)
|
|||
semProcessesCounter->P();
|
||||
processes++;
|
||||
semProcessesCounter->V();
|
||||
DEBUG('x', "Increase Process counter:%d\n", processes);
|
||||
DEBUG('c', "Increase Process counter:%d\n", processes);
|
||||
#endif //CHANGED
|
||||
|
||||
AddrSpaceList.Append(this);
|
||||
|
@ -190,11 +190,10 @@ AddrSpace::~AddrSpace ()
|
|||
}
|
||||
#endif
|
||||
|
||||
DEBUG('s',"Delete Page Table\n");
|
||||
DEBUG('c',"Delete Page Table\n");
|
||||
delete [] pageTable;
|
||||
pageTable = NULL;
|
||||
|
||||
AddrSpaceList.Remove(this);
|
||||
#ifdef CHANGED
|
||||
DEBUG('c',"Delete Semaphores, memorymap\n");
|
||||
delete semThreadsCounter;
|
||||
|
@ -204,11 +203,12 @@ AddrSpace::~AddrSpace ()
|
|||
processes--;
|
||||
semProcessesCounter->V();
|
||||
DEBUG('c', "Decrease Process counter:%d\n", processes);
|
||||
#endif
|
||||
if ( processes == 0 ){
|
||||
DEBUG('c', "No more processes on RAM, call Exit()\n");
|
||||
interrupt->Powerdown();
|
||||
}
|
||||
#endif
|
||||
AddrSpaceList.Remove(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -91,7 +91,11 @@ void do_ThreadExit(){
|
|||
delete currentThread->space;
|
||||
currentThread->space = NULL;
|
||||
}
|
||||
|
||||
DEBUG('x', "Thread killed!\n");
|
||||
currentThread->Finish();
|
||||
|
||||
DEBUG('x', "Thread killed!\n");
|
||||
}
|
||||
|
||||
void StartUserProc( void * args ){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue