Beispiel #1
0
int main(int argc, char *argv[])
{

	list_entry_t *pos;
	int byteStart, byteEnd, globalEnd;
	struct ProcStruct *next;

	schedInit();                                          //init schedule 
  
	printf("SchedInit finished!\n");
	
	cpu_init();                                          //init cpu
 
	printf("Cpu init finished!\n");

	initProcList();                                      //runnbale process 
 
	printf("Init process list finished!\n");

	procInit();                                          //init process table

	printf("The first proc init finished!\n");

	initWaitQueue();                                     //init wait queue

	printf("Init wait queue finished!\n");

	bc_read(&byteStart, &byteEnd, &globalEnd);           //读取字节码

	/*
	for (int i = 0; i < 7; i++) {
		printf("%d %d %d\n", byte_code[i].code, byte_code[i].arg1, byte_code[i].arg2);
	}
*/
	createProcess(byteStart, byteEnd, globalEnd);        //根据字节码的初始下标和终止下标创建第一个进程

//	createProcess(0, 9, 3);                              //根据字节码的初始下标和终止下标创建第一个进程

	printCurrent();

	addRunEqueue();                                     //将创建的进程加入到就绪队列
	
	printf("The proc addRunEqueu finished!\n");


	    while (cpu_state != 0 && rq->proc_num)
	    {
		    printf("schedul start...\n");
		    cpuSchedProc();
	    }
	    while (rq->proc_num == 0 && wq->wait_num != 0)
	    {
		    next = waitQueuePickNext(wq);
		    delWaitQueue(wq, next);
		    schedClassEnqueue(next);
		    schedule();
	    }
	
	return 0;
}
Beispiel #2
0
eFBCTunerManager::eFBCTunerManager()
{
	ePtr<eDVBResourceManager> res_mgr;
	eDVBResourceManager::getInstance(res_mgr);
	m_res_mgr = res_mgr;

	/* num of fbc tuner in one set */
	m_fbc_tuner_num = getFBCTunerNum();
	procInit();
}
Beispiel #3
0
int main(int argc, char **argv)
{
        int threads = 2, switches = 7, doUpgrades = 0, doNonBlock = 0;
        //int threads = 2, switches = 7, doUpgrades = 0, doNonBlock = 1;
        //int threads = 3, switches = 5, doUpgrades = 0, doNonBlock = 1;
        //int threads = 4, switches = 3, doUpgrades = 0, doNonBlock = 0;

        procInit(resetLock, switches);

        assert(NUM_MODES <= LC_MAX_MODES);
        lcInitConflictTable(&conflictTable, conflicts, NUM_MODES);
        gslLockInit(&theLock, NULL);

        for (int i = 0; i < threads; ++i) {
                char name[2] = {i + 'A', 0};
                proc_t *proc = procAdd(name, testLock);
                testPerProc_t *perProc = calloc(1, sizeof *perProc);
                proc->user = perProc;
        }

        generateRun(0, 0, doUpgrades, doNonBlock);

        return 0;
}