本文整理汇总了C++中create_process函数的典型用法代码示例。如果您正苦于以下问题:C++ create_process函数的具体用法?C++ create_process怎么用?C++ create_process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_process函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
示例6: main
void main(void)
{
kernel_init();
create_process(ex_ps1);
create_process(ex_ps2);
create_process(ex_ps3);
scheduler();
}
示例7: notmain
//-----------------------------------------------------------------------------
int
notmain ( void )
{
create_process( turn_led_off );
create_process( play_music );
start_scheduler();
return 0;
}
示例8: kmain
void kmain()
{
init_kernel();
create_process(&process1);
create_process(&process2);
start_kernel();
__asm("cps 0x10"); // CPU to USER mode
while (1) ;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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 );
}
}