• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ create_process函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中create_process函数的典型用法代码示例。如果您正苦于以下问题:C++ create_process函数的具体用法?C++ create_process怎么用?C++ create_process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_process函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: init_multitasking

void init_multitasking()
{
  asm volatile("cli");

  kernel_proc = create_process("microkernel", 0, 1, 0);
  kernel_proc->pgdir = (uint32_t)system_dir;

  new_process = (uint32_t)kernel_proc;

  current_task = (uint32_t)create_task("initiating_task",tasking_initiator, 0, 0x202, kernel_proc);  //Scheduler initalization task
  old_task = current_task;

  Spurious_task = create_task("Spurious_task", Spurious_task_func, 0, 0x202, kernel_proc);
  Spurious_task->special = 1;

  Idle_task = create_task("System_idle_task",idle, 0, 0x202, kernel_proc);  //default task, this dosent run
  Idle_task->special = 1;

  Shell_proc = create_process("Shell", 0, 1, kernel_proc);
  Shell_Ostream_task = create_task("Shell_Ostream", Shell_Double_buffer, 10, 0x202, Shell_proc);
  Activate_task_direct(Shell_Ostream_task); //This is the task which would make printing to console possible!
  Shell_Istream_task = create_task("Shell_Istream", Shell_Input, 1, 0x202, Shell_proc);
  Activate_task_direct(Shell_Istream_task); //This would manage keyboard input and delivery to the required process.
  //Shell_Istream_task->special = 1;
  Shell_task = create_task("Shell_task", Shell, 5, 0x202, Shell_proc);  //Main shell task.
  //Shell_task->special = 1;
  Activate_task_direct(Shell_task);

  SAS_proc = create_process("SAS", 0, 1, kernel_proc); //Scheduler Assistance System process.
  Activate_task_direct(create_task("SAS_init", SAS_init, 1, 0x202, SAS_proc)); //Initialization of SAS system.

  reached_bottom = 0;
  Scheduler_init(); // Let the FUN Begin :D Lets Switch from the old monotasking world to Multitasking World :D defined in tasking.asm
  while(1); //Never comeback :D
}
开发者ID:Aqeous-OS,项目名称:Aqeous,代码行数:35,代码来源:tasking.c


示例2: kmain

int kmain (void){
	init_hw();
  	uart_init();
  	
	/*-- INPUT --*/
	//char buffer[32];
  	//uart_receive_str(buffer, 32);  //read

	/*-- PROCESS --*/
	create_process(funcA, NULL, STACK_SIZE,0);
	create_process(funcB, NULL, STACK_SIZE,0);
	create_process(functC,NULL,STACK_SIZE,1);
	
	/*-- virtual memory --*/
	//init_kern_translation_table();

	//configure_mmu_C();
	//start_mmu_C();

	//uint32_t* pt = (uint32_t*)vMem_Alloc(1);
	//*pt = sizeof(uint32_t);
	//uint32_t* pt = 0x500000;
	
	/*-- start --*/
	start_sched();

	while(1){}
	/* Pas atteignable vues nos 2 fonctions */
	return 0;
  
}
开发者ID:H4104,项目名称:Os-Raspeberry,代码行数:31,代码来源:kernel.c


示例3: init_multitasking

void init_multitasking()
{
  asm volatile("cli");
  //memset((void*)(200*1024*1024),0,(40*1024*1024));
  kernel_proc = create_process("microkernel", 0, 1, 0);

  new_process = (uint32_t)kernel_proc;

  current_task = (uint32_t)create_task("initiating_task",tasking_initiator, 20, 0x202, kernel_proc);  //Scheduler initalization task
  old_task = current_task;

  Idle_task = create_task("System_idle_task",idle, 20, 0x202, kernel_proc);  //default task
  Activate_task_direct(Idle_task);

  Activate_task_direct(create_task("idle2",idle2, 10, 0x202, kernel_proc));
  Activate_task_direct(create_task("idle3",idle3, 10, 0x202, kernel_proc));
  Activate_task_direct(create_task("idle4",idle4, 10, 0x202, kernel_proc));
  Activate_task_direct(create_task("idle5",idle5, 10, 0x202, kernel_proc));
  Activate_task_direct(create_task("idle6",idle6, 10, 0x202, kernel_proc));
  //Activate_task_direct(create_task("Main_Kernel",kernel_main, 10, 0x202, kernel_proc));

  Shell_proc = create_process("Shell", 0, 1, kernel_proc);
  Activate_task_direct(create_task("Shell_Ostream", Console_Writer, 10, 0x202, Shell_proc));
  reached_bottom = 0;
  Scheduler_init(); // Let the FUN Begin :D Lets Switch from the old monotasking world to Multitasking World :D defined in tasking.asm
}
开发者ID:vinoh,项目名称:Aqeous,代码行数:26,代码来源:tasking.c


示例4: multi_processes_test

void multi_processes_test()
{
	int rc, status;
	int pid1, pid2, pid3;
	char *process_test1[] = {
		"/process_test",
		"alice",
		NULL
	};
	char *process_test2[] = {
		"/process_test",
		"bob",
		NULL
	};
	char *process_test3[] = {
		"/process_test",
		"cathy",
		NULL
	};

	pid1 = create_process(process_test1[0], process_test1, 0, 16);
	if (pid1 == -1) {
		printf("create_process failed, err(%d).\n", pid1);
		goto out;
	}

	pid2 = create_process(process_test2[0], process_test2, 0, 16);
	if (pid2 == -1) {
		printf("create_process failed, err(%d).\n", pid2);
		goto out;
	}

	pid3 = create_process(process_test3[0], process_test3, 0, 16);
	if (pid3 == -1) {
		printf("create_process failed, err(%d).\n", pid3);
		goto out;
	}

	rc = waitpid(pid1, &status, 0);
	if (rc != 0) {
		printf("wait alice failed, err(%d).\n", rc);
	}

	rc = waitpid(pid2, &status, 0);
	if (rc != 0) {
		printf("wait bob failed, err(%d).\n", rc);
	}

	rc = waitpid(pid3, &status, 0);
	if (rc != 0) {
		printf("wait cathy failed, err(%d).\n", rc);
	}

 out:
	return;
}
开发者ID:Ted-Chang,项目名称:matrix,代码行数:56,代码来源:unit_test.c


示例5: kmain

//------------------------------------------------------------------------
int kmain ( void )
{
	init_hw();
	create_process(funcB, NULL, STACK_SIZE);
	create_process(funcA, NULL, STACK_SIZE);
	start_sched();
	ctx_switch();
	/* Pas atteignable vu nos 2 fonctions */
	return 0;
}
开发者ID:IF-JAJAGA,项目名称:OS-Amaury-Jerome,代码行数:11,代码来源:kernel.c


示例6: main

void main(void)
{
	kernel_init();

	create_process(ex_ps1);
	create_process(ex_ps2);
	create_process(ex_ps3);

	scheduler();
}
开发者ID:chywoo,项目名称:vos,代码行数:10,代码来源:main.c


示例7: notmain

//-----------------------------------------------------------------------------
int
notmain ( void )
{

	create_process( turn_led_off );
	create_process( play_music );

	start_scheduler();

 	return 0;
}
开发者ID:jdugue,项目名称:mini-OS-RPI,代码行数:12,代码来源:notmain.c


示例8: kmain

void kmain()
{
	init_kernel();

	create_process(&process1);
	create_process(&process2);
	
	start_kernel();
	
	__asm("cps 0x10"); // CPU to USER mode
	
	while (1) ;
}
开发者ID:Gazolik,项目名称:OS-RaspberryPi,代码行数:13,代码来源:kmain-isolation.c


示例9: test_ipc_3

/*
 * This test creates a sender and a receiver process. The receiver process
 * has the higher priority and is scheduled first. 
 * The execution sequence is as follow:
 * 1. The receiver executes a receive() and becomes RECEIVE_BLOCKED. 
 * 2. The sender gets executed and does a send(). The message is immediately
 *    delivered, unblocking the receiver and making the sender REPLY_BLOCKED.
 * 3. The receiver is executed. It does a receive and becomes RECEIVE_BLOCKED
 *    again.  
 * 4. The sender gets executed and does a message(). The message is immediately
 *    delivered, unblocking the receiver. The sender is still STATE_READY.
 * 5. The receiver gets the execution again. 
 * This test send() and message() in the case that the receiver is  
 * ready to receive. It also test receive() in the case that there is no 
 * messages pending. 
 */
void test_ipc_3()
{
    PORT new_port;

    test_reset();
    new_port = create_process (test_ipc_3_receiver_process, 6, 0, "Receiver");
    create_process(test_ipc_3_sender_process, 5, (PARAM) new_port, "Sender");
    resign();

    kprintf("Back to boot.\n");  
    if (check_sum == 1 || check_sum == 7)
	test_failed(52);
}
开发者ID:AbhijitParate,项目名称:TOS,代码行数:29,代码来源:test_ipc_3.c


示例10: start_kernel

//------------------------------------------------------------------------
int start_kernel ( void ) {
    malloc_init((void *) HEAP_START);

    create_process(&funcOne, (void*) 0);
    create_process(&funcTwo, (void*) 0);

    sem_init(&sem_test, 1);
    
    start_sched();

    /* Pas atteignable vues nos 2 fonctions */
    return(0);
}
开发者ID:halflings,项目名称:process-scheduler,代码行数:14,代码来源:kernel.c


示例11: ls_test

void ls_test()
{
	int rc, status;
	char *ls_root[] = {
		"/ls",
		"-l",
		"/",
		NULL
	};
	char *ls_proc[] = {
		"/ls",
		"/proc",
		NULL
	};
	char *ls_dev[] = {
		"/ls",
		"/dev",
		NULL
	};

	printf("unit_test list directory:\n");

	printf("listing /\n");
	rc = create_process(ls_root[0], ls_root, 0, 16);
	if (rc == -1) {
		printf("create_process(%s) failed, err(%d).\n", ls_root[0], rc);
		goto out;
	}

	rc = waitpid(rc, &status, 0);

	printf("listing /proc\n");
	rc = create_process(ls_proc[0], ls_proc, 0, 16);
	if (rc == -1) {
		printf("create_process(%s) failed, err(%d).\n", ls_proc[0], rc);
		goto out;
	}

	rc = waitpid(rc, &status, 0);

	printf("listing /dev\n");
	rc = create_process(ls_dev[0], ls_dev, 0, 16);

	rc = waitpid(rc, &status, 0);
	if (rc == -1) {
		printf("waiting %s failed, err(%d).\n", ls_proc[0], rc);
	}

 out:
	return;
}
开发者ID:Ted-Chang,项目名称:matrix,代码行数:51,代码来源:unit_test.c


示例12: kmain

void kmain( void )
{    
    sched_init();
    
    p1=create_process((func_t*)&user_process_1);
    p2=create_process((func_t*)&user_process_2);
    
    __asm("cps 0x10"); // switch CPU to USER mode
    // **********************************************************************
    
    sys_yieldto(p1);

    // this is now unreachable
    PANIC();
}
开发者ID:nicondsc,项目名称:TP-SEA,代码行数:15,代码来源:kmain-yieldto.c


示例13: main

int main(int argc, char *argv[])
{
	unsigned short volume;
	pid_t pid = create_process();

	switch(pid) {
		case -1:
			return EXIT_FAILURE;
			break;
		case 0:
			if(argc > 1)
			{
				if(sscanf(argv[1], "%d", &volume) != EOF)
				{
					if(volume >= 0 && volume <= 100)
					{
						change_volume(volume);
					}
				}
			}
		break;
		default:
			if(wait(NULL) == -1) {
				perror("wait :");
				exit(EXIT_FAILURE);
			}
	}

	return 0;
}
开发者ID:CronosProject,项目名称:chronos,代码行数:30,代码来源:soundmaster.c


示例14: main

int main() {

  pptr head=NULL;
  pptr tail=NULL;
  int i=0;
  int tprio,tarr_time,tburst_time,tpid;
  pptr tprocess;
  FILE *read;
  read=fopen("inputp","r");
  write=fopen("write","w");
  //trace=fopen("trace","w");
  for(i=1;i<=3;i++) {
    tpid=++g_pid;
    fscanf(read,"%d",&tarr_time);
    fscanf(read,"%d",&tburst_time);
    fscanf(read,"%d",&tprio);//toscan the priority
    tprocess=create_process(tpid,tarr_time,tburst_time);
    tprocess->over=tprio;//assigning prio
    add_to_queue(&head,&tail,tprocess);
  } fclose(read);

  tprocess=head;
  i=0;
  while(tprocess!=NULL) {
    ++i;
    tprocess=tprocess->next;
  }
  priopre(&head,&tail,i);
  return 0;
}
开发者ID:TheInnovators,项目名称:Scheduling-Algorithms-Lib,代码行数:30,代码来源:priopre.c


示例15: master_socket_poll_event

/* handle a socket event */
static void master_socket_poll_event( struct fd *fd, int event )
{
    struct master_socket *sock = get_fd_user( fd );
    assert( master_socket->obj.ops == &master_socket_ops );

    assert( sock == master_socket );  /* there is only one master socket */

    if (event & (POLLERR | POLLHUP))
    {
        /* this is not supposed to happen */
        fprintf( stderr, "wineserver: Error on master socket\n" );
        release_object( sock );
    }
    else if (event & POLLIN)
    {
        struct sockaddr_un dummy;
        unsigned int len = sizeof(dummy);
        int client = accept( get_unix_fd( master_socket->fd ), (struct sockaddr *) &dummy, &len );
        if (client == -1) return;
        if (sock->timeout)
        {
            remove_timeout_user( sock->timeout );
            sock->timeout = NULL;
        }
        fcntl( client, F_SETFL, O_NONBLOCK );
        create_process( client, NULL, 0 );
    }
}
开发者ID:howard5888,项目名称:wineT,代码行数:29,代码来源:request.c


示例16: sc_syscall

void sc_syscall(ProcessState ** processtable, ProcessState * myprocess, SyscallReq * req) {
  //http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html
  switch(req->trapcode) { // read
    case 0b00000000000: do { // exit
      myprocess->state = 0;
    }while(0);break;

    case 0b00000000001: do { // fork
      ProcessState * newprocess = create_process(processtable, NULL, myprocess);
      if(newprocess == NULL){
        printf("process table is full\n");
      }
      newprocess->registers.ax.reg = 0;
      myprocess->registers.ax.reg = newprocess->pid;
    }while(0);break;

    case 0b00000000010: do {
      myprocess->registers.ax.reg = read(req->ax, &(myprocess->mem[req->ex]), req->fx);
    }while(0);break;

    case 0b00000000011: do { //write
      myprocess->registers.ax.reg = write(req->ax, &(myprocess->mem[req->ex]), req->fx);
    }while(0);break;

    default: do {

    }while(0);break;
  }
}
开发者ID:blackle,项目名称:sidechannel,代码行数:29,代码来源:main.c


示例17: test_ipc_2

/*
 * This test creates a sender and a receiver process. The sender process
 * has the higher priority and will be scheduled first.
 * The execution sequence is as follow:
 * 1. The sender executes a send(). Since the receiver is not RECEIVE_BLOCKED,
 *    the sender will be SEND_BLOCKED.
 * 2. Execution resumes with the receiver. The receiver executes a receive(),
 *    which will return immediately, and change the sender to state
 *    REPLY_BLOCKED.
 * 3. The receivers does a reply(), and put the sender back on the ready queue.
 *    The resign() in the reply() will therefore transfer the control back to
 *    the sender.
 * 4. The sender executes a message(). Since the receiver is not
 *    RECEIVE_BLOCKED, the sender will be MESSAGE_BLOCKED.
 * 5. Execution resumes with the receiver. The receiver executes a receive(),
 *    which will return immediately, and change the sender to STATE_READY.
 * 6. The receiver does a resign() and pass the execution back to the sender.
 * This test send() and message() in the case that the receiver is not
 * ready to receive. It also test receive() in the case that there are messages
 * pending.
 */
void test_ipc_2 ()
{
    PORT new_port;

    test_reset();
    new_port = create_process (test_ipc_2_receiver_process, 5, 0, "Receiver");
    create_process (test_ipc_2_sender_process, 6, (PARAM) new_port, "Sender");

    check_num_proc_on_ready_queue(3);
    check_process("Sender", STATE_READY, TRUE);
    check_process("Receiver", STATE_READY, TRUE);
    if (test_result != 0)
       test_failed(test_result);

    resign();
}
开发者ID:weighan,项目名称:tos,代码行数:37,代码来源:test_ipc_2.c


示例18: test_dispatcher_4

/*
 * Creates two new processes with different priorities. When the main
 * thread calls resign(), execution should continue with test_process_c()
 * This process then removes itself from the ready queue and calls resign()
 * again. Execution should then continue in test_process_a()
 */
void test_dispatcher_4()
{
    test_reset();
    create_process(test_dispatcher_4_process_a, 5, 42, "Test process A");
    kprintf("Created process A\n");
    create_process(test_dispatcher_4_process_c, 7, 0, "Test process C");
    kprintf("Created process C\n");

    check_sum = 0;
    resign();
    if (check_sum == 0)
       test_failed(21); 

    if (check_sum != 3)
       test_failed(22); 
}
开发者ID:AbhijitParate,项目名称:TOS,代码行数:22,代码来源:test_dispatcher_4.c


示例19: timer_process

void timer_process(PROCESS self, PARAM param) {
    PROCESS sender;
    int proc_index;
    int i;

    create_process(timer_notifier, 7, 0, "Timer notifier");
    while (42) {
        Timer_Message *msg = receive(&sender);
        if (msg != NULL) {
            // Message from client
            proc_index = sender - pcb;
            assert(sender == &pcb[proc_index]);
            ticks_remaining[proc_index] = msg->num_of_ticks;
        } else {
            // Message from timer notifier
            for (i = 0; i < MAX_PROCS; i++) {
                if (ticks_remaining[i] != 0) {
                    ticks_remaining[i]--;
                    if (ticks_remaining[i] == 0) {
                        assert(pcb[i].state == STATE_REPLY_BLOCKED);
                        reply(&pcb[i]);
                    }
                }
            }
        }
    }
}
开发者ID:yeqingyan,项目名称:tos_tos,代码行数:27,代码来源:timer.c


示例20: create_process

void create_process(int depth, char** argv)
{
	int pid, status;

	// Jeśli dziecko
	if((pid = fork()) == 0)
	{
		if(depth > 0)
			create_process(depth - 1, argv);	
		printf("Rozpoczęcie procesu potomnego %d, pid %d\n", depth, getpid());
		struct timespec t = {0, MS_TO_NS(500)};
		int i;
		int steps = atoi(argv[depth + 2]);
		for(i = 0; i <= steps; ++i)
		{
			printf("Potomny %d, krok %d/%d\n", depth, i, steps);
			nanosleep(&t, NULL);
		}
		printf("Koniec procesu potomnego %d, pid %d\n", depth, getpid());

		if(depth > 0)
		{
			pid = wait(&status);
			printf("Proces %d, zakończony: kod %d\n", pid, WEXITSTATUS(status));
		}
		
		exit(depth);
	}
}
开发者ID:iceslab,项目名称:Programowanie_wspolbiezne,代码行数:29,代码来源:fork_list.c



注:本文中的create_process函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ create_queue函数代码示例发布时间:2022-05-30
下一篇:
C++ create_proc_read_entry函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap