jos_c1

jos_c1 - /* * jos.c - starting point for student's os. * */...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
* jos.c -- starting point for student's os. * */ #include "simulator.h" #include "jos.h" #include <thread.h> #define MAX_OS_THREADS 3 typedef void * (*RunFunction)(void *); JOS_GLOBALS JG; /*static char *Argv[5]={ "argtest","Rex,","my","man!",NULL };*/ static char *Argv[2]={ "a.out",NULL}; /* Called once to initialize the global variables */ initialize_global_jos_state() { JG.readyq = new_dllist(); JG.nulljob = (PCB *) malloc(sizeof(PCB)); /* This doesn't do anything, but gives me a place holder for noop() jobs */ JG.nextin=0; JG.nextout=0; sema_init(&JG.writeok,0,USYNC_THREAD,NULL); sema_init(&JG.consoleWait,0,USYNC_THREAD,NULL); sema_init(&JG.nelem,0,USYNC_THREAD,NULL); sema_init(&JG.writers,1,USYNC_THREAD,NULL); sema_init(&JG.readers,1,USYNC_THREAD,NULL); } initialize_user_process(char **filename) { int i,k,argc,argv; PCB *init_pcb; int *argv_ptr; int tos; int temp; argc=1; argv_ptr=(int *)malloc(sizeof(int)*argc); bzero(main_memory,MemorySize); if(temp=load_user_program(filename[0]) <0) { fprintf(stderr,"Can't load program.\n");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

jos_c1 - /* * jos.c - starting point for student's os. * */...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online