Changeset 441 for trunk/user
- Timestamp:
- May 9, 2018, 3:13:56 PM (7 years ago)
- Location:
- trunk/user
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/init/init.c
r440 r441 18 18 #include <pthread.h> 19 19 20 #define DEBUG_INIT 120 #define DEBUG_INIT_PROCESS 1 21 21 22 22 // TODO make the cxy computation portable [AG] … … 76 76 } 77 77 78 #if DEBUG_INIT 78 #if DEBUG_INIT_PROCESS 79 79 80 80 unsigned int x_size; // number of clusters in a row … … 160 160 } // end KSH kill handling 161 161 162 #if ( DEBUG_INIT )162 #if DEBUG_INIT_PROCESS 163 163 164 164 // INIT displays processes and threads in all clusters -
trunk/user/ksh/ksh.c
r440 r441 395 395 int ret_exec; // return value from exec 396 396 unsigned int ksh_pid; // KSH process PID 397 unsigned int new_pid; // new process PID398 unsigned int rcv_pid; // terminating process PID399 397 char * pathname; // path to .elf file 400 398 unsigned int background; // background execution if non zero … … 425 423 else if (ret_fork == 0) // it is the CHILD process 426 424 { 427 // give back to KSH terminal ownership if required428 if( background ) fg( ksh_pid );429 430 425 // CHILD process exec NEW process 431 426 ret_exec = exec( pathname , NULL , NULL ); 432 427 428 // this is only executed in case of exec failure 433 429 if( ret_exec ) 434 430 { 435 printf(" error: newprocess unable to exec <%s>\n", pathname );436 return;431 printf(" error: child process unable to exec <%s>\n", pathname ); 432 exit( 0 ); 437 433 } 438 434 } 439 435 else // it is the parent KSH : ret_fork is the new process PID 440 436 { 441 new_pid = ret_fork; 442 443 // wait new process completion 444 rcv_pid = wait( &status ); 445 446 if( rcv_pid == new_pid ) 447 { 448 printf("\n\n %s normal termination / status = %x\n\n", 449 pathname , (status &0xFF) ); 450 return; 451 } 452 else 453 { 454 printf("\n\n %s abnormal termination / status = %x\n\n", 455 pathname , (status &0xFF) ); 456 return; 457 } 437 // give back terminal ownership to KSH if new process created in background / 438 // wait new process completion before returning to command interpreter otherwise 439 if( background ) fg( ksh_pid ); 440 else wait( &status ); 441 442 // return to command interpreter 443 return; 458 444 } 459 445 } // end cmd_load … … 758 744 printf("# "); 759 745 } 746 else 747 { 748 printf("\n# "); 749 } 760 750 } 761 751 else if (c == '\t') // tabulation => do nothing -
trunk/user/sort/sort.c
r440 r441 156 156 unsigned int main_uid = ptr->main_uid; 157 157 158 printf("\n### core[%x,%d] enter sort : threads %d / thread_uid %x / main_uid %x / cycle %d\n",159 cxy, lid, threads, thread_uid, main_uid, (int)cycle );160 161 while( 1 ) { asm volatile("nop"); }162 163 158 unsigned int items = ARRAY_LENGTH / threads; 164 159 unsigned int stages = __builtin_ctz( threads ) + 1; … … 316 311 if( thread_uid != main_uid ) 317 312 { 318 319 get_cycle( &cycle );320 printf("\n### main creates thread_uid %d / &sort_arg %x / cycle %d\n",321 thread_uid, &arg[thread_uid], (unsigned int)cycle );322 323 313 if ( pthread_create( &trdid, // not used because no join 324 314 &attr[thread_uid], // thread attributes … … 344 334 sort( &arg[main_uid] ); 345 335 336 while( 1 ) asm volatile( "nop" ); 337 346 338 // Check result 347 339 int success = 1; … … 352 344 (threads==512) ) ? array1 : array0; 353 345 354 for( n=0 ; n<(ARRAY_LENGTH- 1) ; n++ )346 for( n=0 ; n<(ARRAY_LENGTH-2) ; n++ ) 355 347 { 356 348 if ( res_array[n] > res_array[n+1] )
Note: See TracChangeset
for help on using the changeset viewer.