예제 #1
0
int body()
{ 
	char c;

	printf("proc %d starts from body()\n", running->pid);

	while(1)
	{
		//prints the list of procs that are initializedd and free
		printQueue(freeList);// optional: show the freeList

		//print ready queue which are procs that are ready
		printQueue(readyQueue); // show the readyQueue

		printf("proc %d running: parent=%d\n",running->pid,running->ppid);
		printf("enter a char [s or f] : ");
		c = getc(); printf("%c\n", c);
		switch(c)
		{
			case 'f': //fork a child off of the current process
				do_kfork();
				break;
			case 's': //switch to next process in ready queue
				do_tswitch();
				break;
			case 'q': //zombie the current process
				my_exit();
				break;
		}
	}
}
예제 #2
0
파일: t.c 프로젝트: B-Rich/CptS460
int body()
{
    char c;
    printf("proc %d resumes to body()\n", running->pid);
    while(1){
        printf("-----------------------------------------\n");
        printList("freelist  ", freeList);
        printList("readyQueue", readyQueue);
        printList("sleepList ", sleepList);
        printf("-----------------------------------------\n");

        printf("proc %d running: parent = %d  enter a char [s|f|w|q|u] : ", 
                running->pid, running->parent->pid);

        c = getc(); printf("%c\n", c);
        switch(c){
            case 's' : do_tswitch();   break;
            case 'f' : do_kfork();     break;
            case 'w' : do_wait();      break;
            case 'q' : do_exit();      break;

            case 'u' : goUmode();      break;
        }
    }
}
예제 #3
0
int body()
{ 
	char c;

	printf("proc %d starts from body()\n", running->pid);

	while(1)
	{
		printf("-----------------------------------------\n");
		//prints the list of procs that are initializedd and free
		printf("freelist = ");
		printQueue(freeList);// optional: show the freeList

		//print ready queue which are procs that are ready
		printf("readyQueue = ");
		printQueue(readyQueue); // show the readyQueue

		//printf("sleepList = ");
		//printQueue(sleepList);

		printf("-----------------------------------------\n");

		printf("proc %d running: parent=%d\n",running->pid,running->ppid);
		printf("enter a char [s|f|q z|a|w] : ");

		c = getc();
		printf("%c\n", c);

		switch(c)
		{
			case 'f': //fork a child off of the current process
				do_kfork();
				break;
			case 's': //switch to next process in ready queue
				do_tswitch();
				break;
			case 'q': //zombie the current process
				do_exit();
				break;
			case 'z': //running PROC go to sleep on an event value
				do_sleep();
				break;
			case 'a': //wakeup all PROCs sleeping on event
				do_wakeup();
				break;
			case 'w': //to wait for a ZOMBIE child
				do_wait();
				break;
		}
	}
}
예제 #4
0
파일: t.c 프로젝트: tymicruz/CuatroSeisZero
int body()
{ 
   char c;
        color = running->pid + 7;

   printf("\nproc %d resumes to body()\n", running->pid);
   while(1){
     color = running->pid + 7;
     printQueue(freeList, "freeList");
     printQueue(readyQueue, "readyQueue");

     printf("proc %d running : \nenter a key (s|q|f | z|a|w): ", running->pid);
     c = getc();
	printf("%c\n", c);
     switch(c)
     {
     	case 's':
     		tswitch();
     	break;

     	case 'q':
     		do_exit();
     	break;

     	case 'f':
     		do_kfork();
     	break;
     	case 'z':
     		//printf("sleep\n");
     		do_sleep();
     	//go to sleep on an even
     	break;
     	case 'a':
     		//printf("wake up\n");
     		do_wakeup();
     	//wakeup all procs sleeping on event
     	break;
     	case 'w':
     		//printf("wait\n");
     		do_wait();
     	//wait for a ZOMBIE child
     	break;
     }

     
     //tswitch();
   }
}
예제 #5
0
파일: t.c 프로젝트: kurutoga/mtx_system
int body()
{
    char c; 
    myprintf("proc %d starts from body()\n", running->pid);
    while(1){
       printq("freelist  ", freeList);// optional: show the freeList
       printq("readyQueue", readyQueue); // show the readyQueue
       myprintf("proc %d running: parent=%d\n",running->pid,running->ppid);
       myprintf("enter a char [s|f] : ");
       c = getc(); myprintf("%c\n", c);

       switch(c){
            case 'f' : do_kfork();    break;
            case 's' : do_tswitch();  break;
       }
    }
}
예제 #6
0
int body()
{ 
   char c;
   printf("proc %d resumes to body()\n", running->pid);
   while(1)
   {
    printGlobals();
    color = running->pid + 7;
    printf("proc %d running : enter a key : ", running->pid);
    c = getc(); 
    printf("%c\n", c);
    
    switch(c)
    {
      case 'f' : do_kfork(); break;
      case 's' : do_tswitch(); break;
      case 'q' : do_exit(); break;
    }
   }
}
예제 #7
0
int body()
{
	char c;
	printf("proc %d resumes to body()\n", running->pid);
	while(1)
	{
		printf("-----------------------------------------\n");
		//print freeList;
		printf("Free List:\n");
		printQueue(freeList);
		// print readyQueue;
		printf("Ready Queue:\n");
		printQueue(readyQueue);
		// print sleepList;
		printf("Sleep List:\n");
		// printSleepQueue(sleepList);
		printSleepQueue(sleepList);
		printf("-----------------------------------------\n");

		printf("proc %d[%d] running: parent=%d\n",
			running->pid, running->priority, running->ppid);

		printf("type a command [s|f|q|w| u ] : ");
		c = getc();
		printf("%c\n", c);

		switch(c){
			case 's' : do_tswitch();   break;
			case 'f' : do_kfork();     break;
			case 'q' : do_exit();      break;
			case 'w' : do_wait();      break;
			case 'u' :
				// printf("Running->uss: %x\n", running->uss);
				// printf("Running->usp: %x\n", running->usp);
				goUmode();
				break;   // let process goUmode
		}
	}
}
예제 #8
0
int body()
{
	char c;
	printf("proc %d resumes to body()\n", running->pid);
	while(1)
	{
		printf("-----------------------------------------\n");
		//print freeList;
		printf("Free List:\n");
		printQueue(freeList);
		// print readyQueue;
		printf("Ready Queue:\n");
		printQueue(readyQueue);
		// print sleepList;
		printf("Sleep List:\n");
		printSleepQueue(sleepList);
		printf("-----------------------------------------\n");

		printf("proc %d[%d] running: parent=%d\n",
			running->pid, running->priority, running->ppid);

		printf("type a char [s|f|q| p|z|a| w ] : ");
		c = getc(); 
		printf("%c\n", c);

		switch(c){
			case 's' : do_tswitch();   break;
			case 'f' : do_kfork();     break;
			case 'q' : do_exit();      break; 
			case 'p' : do_ps();        break; 
			case 'z' : do_sleep();     break; 
			case 'a' : do_wakeup();    break; 
			case 'w' : do_wait();      break;
		}
	}
}
예제 #9
0
int body()
{ 
   char c;
   printf("proc %d resumes to body()\n", running->pid);
   while(1){
     color = running->pid + 7;
     printf("proc %d running : enter a key : ", running->pid);
     c = getc(); 
     switch(c){
		case 'f' : do_kfork(); break;
		
		case 's' : tswitch(); break;
		
		case 'q':
		running->status = ZOMBIE; 
		running->priority = 0; 
		put_proc(&freeList, running); 
		tswitch();
		break;
	 
		case 'p':	  
		printf("*****readyQueue: ");
		printQueue(readyQueue);
		printf("\n");
		
		printf("*****freeList: ");
		printQueue(freeList);
		printf("\n");

		break;

		default: printf("ERROR: invalid key\n"); break;

	 }
   }
}