Changeset 635 for trunk/user/ksh/ksh.c


Ignore:
Timestamp:
Jun 26, 2019, 11:42:37 AM (16 months ago)
Author:
alain
Message:

This version is a major evolution: The physical memory allocators,
defined in the kmem.c, ppm.c, and kcm.c files have been modified
to support remote accesses. The RPCs that were previously user
to allocate physical memory in a remote cluster have been removed.
This has been done to cure a dead-lock in case of concurrent page-faults.

This version 2.2 has been tested on a (4 clusters / 2 cores per cluster)
TSAR architecture, for both the "sort" and the "fft" applications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user/ksh/ksh.c

    r633 r635  
    108108char            pathnew[PATH_MAX_SIZE];     // used by the rename command
    109109 
     110char            string[128];                // used by snprintf() for debug
     111
    110112//////////////////////////////////////////////////////////////////////////////////////////
    111113//         Shell  Commands
     
    121123
    122124#if DEBUG_CMD_CAT
    123 char string[64];
     125snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__);
     126display_string( string );
    124127#endif
    125128
     
    133136
    134137    strcpy( pathname , argv[1] );
     138
     139#if DEBUG_CMD_CAT
     140snprintf( string , 128 , "[ksh] in %s : after strcpy" , __FUNCTION__ );
     141display_string( string );
     142#endif
    135143
    136144    // open the file
     
    145153
    146154#if DEBUG_CMD_CAT
    147 snprintf( string , 64 , "[ksh] %s : file %s open", __FUNCTION__, pathname );
     155snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, pathname );
    148156display_string( string );
    149157#endif
     
    172180
    173181#if DEBUG_CMD_CAT
    174 snprintf( string , 64 , "[ksh] %s : size = %d", __FUNCTION__, size );
     182snprintf( string , 128 , "[ksh] %s : size = %d", __FUNCTION__, size );
    175183display_string( string );
    176184#endif
     
    198206
    199207#if DEBUG_CMD_CAT
    200 snprintf( string , 64 , "[ksh] %s : maped file %d to buffer %x", __FUNCTION__, fd , buf );
     208snprintf( string , 128 , "[ksh] %s : maped file %d to buffer %x", __FUNCTION__, fd , buf );
    201209display_string( string );
    202210#endif
     
    212220
    213221#if DEBUG_CMD_CAT
    214 snprintf( string , 64 , "[ksh] %s : unmaped file %d from buffer %x", __FUNCTION__, fd , buf );
     222snprintf( string , 128 , "[ksh] %s : unmaped file %d from buffer %x", __FUNCTION__, fd , buf );
    215223display_string( string );
    216224#endif
     
    261269
    262270#if DEBUG_CMD_CP
    263 char string[64];
     271snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__);
     272display_string( string );
    264273#endif
    265274
     
    284293
    285294#if DEBUG_CMD_CP
    286 snprintf( string , 64 , "[ksh] %s : file %s open", __FUNCTION__, argv[1] );
     295snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, argv[1] );
    287296display_string( string );
    288297#endif
     
    297306
    298307#if DEBUG_CMD_CP
    299 snprintf( string , 64 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[1] );
     308snprintf( string , 128 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[1] );
    300309display_string( string );
    301310#endif
     
    322331
    323332#if DEBUG_CMD_CP
    324 snprintf( string , 64 , "[ksh] %s : file %s open", __FUNCTION__, argv[2] );
     333snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, argv[2] );
    325334display_string( string );
    326335#endif
     
    333342
    334343#if DEBUG_CMD_CP
    335 snprintf( string , 64 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[2] );
     344snprintf( string , 128 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[2] );
    336345display_string( string );
    337346#endif
     
    357366
    358367#if DEBUG_CMD_CP
    359 snprintf( string , 64 , "[ksh] %s : read %d bytes from %s", __FUNCTION__, len, argv[1] );
     368snprintf( string , 128 , "[ksh] %s : read %d bytes from %s", __FUNCTION__, len, argv[1] );
    360369display_string( string );
    361370#endif
     
    369378
    370379#if DEBUG_CMD_CP
    371 snprintf( string , 64 , "[ksh] %s : write %d bytes to %s", __FUNCTION__, len, argv[2] );
     380snprintf( string , 128 , "[ksh] %s : write %d bytes to %s", __FUNCTION__, len, argv[2] );
    372381display_string( string );
    373382#endif
     
    682691
    683692#if DEBUG_CMD_LOAD
    684 char string[64];
     693snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__);
     694display_string( string );
    685695#endif
    686696
     
    725735
    726736#if DEBUG_CMD_LOAD
    727 snprintf( string , 64 , "[ksh] %s : ksh_pid %x / path %s / bg %d / place %d (%x)\n",
    728 __FUNCTION__, ksh_pid, argv[1], background, placement, cxy );
     737snprintf( string , 128 , "[ksh] %s : <%s> / bg %d / place %d / cxy %x",
     738__FUNCTION__, argv[1], background, placement, cxy );
    729739display_string( string );
    730740#endif
     
    744754
    745755#if DEBUG_CMD_LOAD
    746 snprintf( string , 64 , "[ksh] %s : child_pid %x after fork, before exec\n",
     756snprintf( string , 128 , "[ksh] %s : child (%x) after fork, before exec",
    747757__FUNCTION__ , getpid() );
    748758display_string( string );
     
    753763
    754764#if DEBUG_CMD_LOAD
    755 snprintf( string , 64 , "[ksh] %s : child_pid %x after exec / ret_exec %x\n",
     765snprintf( string , 128 , "[ksh] %s : child (%x) after exec / ret_exec %x",
    756766__FUNCTION__ , getpid(), ret_exec );
    757767display_string( string );
     
    769779
    770780#if DEBUG_CMD_LOAD
    771 snprintf( string , 64 , "[ksh] %s : ksh_pid %x after fork / ret_fork %x\n",
     781snprintf( string , 128 , "[ksh] %s : ksh (%x) after fork / ret_fork %x",
    772782__FUNCTION__, getpid(), ret_fork );
    773783display_string( string );
     
    821831
    822832#if DEBUG_CMD_LS
    823 char string[64];
     833snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__);
     834display_string( string );
    824835#endif
    825836
     
    840851
    841852#if DEBUG_CMD_LS
    842 snprintf( string , 64 , "[ksh] %s : directory <%s> open / DIR %x\n",
     853snprintf( string , 128 , "[ksh] %s : directory <%s> open / DIR %x\n",
    843854__FUNCTION__, pathname , dir );
    844855display_string( string );
     
    863874
    864875#if DEBUG_CMD_LS
    865 snprintf( string , 64 , "[ksh] %s : directory <%s> closed\n",
     876snprintf( string , 128 , "[ksh] %s : directory <%s> closed\n",
    866877__FUNCTION__, pathname );
    867878display_string( string );
     
    929940
    930941#if DEBUG_CMD_PS
    931 char string[64];
     942snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__);
     943display_string( string );
    932944#endif
    933945
     
    948960
    949961#if DEBUG_CMD_PS
    950 snprintf( string , 64 , "\n[ksh] %s : call display_cluster_process()", __FUNCTION__ );
     962snprintf( string , 128 , "\n[ksh] %s : call display_cluster_process()", __FUNCTION__ );
    951963display_string( string );
    952964#endif
     
    11061118
    11071119#if DEBUG_EXECUTE
    1108 printf("\n[ksh] %s : command <%s>\n",
    1109 __FUNCTION__ , buf );
     1120snprintf( string , 128 , "[ksh] enter %s for command <%s>" , __FUNCTION__ , buf );
     1121display_string( string );
    11101122#endif
    11111123
     
    11361148
    11371149#if DEBUG_EXECUTE
    1138 printf("\n[ksh] %s : argc %d / arg0 %s / arg1 %s\n",
     1150snprintf( string , 128 , "\n[ksh] in %s : argc = %d / arg0 = %s / arg1 = %s\n",
    11391151__FUNCTION__ , argc , argv[0], argv[1] );
    11401152#endif
     
    11741186        char           cmd[CMD_MAX_SIZE];               // buffer for one command
    11751187
    1176 #if DEBUG_INTER
    1177 char string[128];
    1178 #endif
    1179 
    1180 
    1181 // 1. first direct command
     1188/* 1. first direct command
    11821189if( sem_wait( &semaphore ) )
    11831190{
     
    11871194else
    11881195{
    1189     printf("\n[ksh] load bin/user/fft.elf\n");
     1196    printf("\n[ksh] load bin/user/sort.elf\n");
    11901197}
    11911198
    1192 strcpy( cmd , "load bin/user/fft.elf" );
     1199strcpy( cmd , "load bin/user/sort.elf" );
    11931200execute( cmd );
    1194 //
     1201*/
    11951202
    11961203
     
    12041211else
    12051212{
    1206     printf("\n[ksh] rm home/fft_1_2_1_4096\n");
     1213    printf("\n[ksh] load bin/user/fft.elf\n");
    12071214}
    12081215
    1209 strcpy( cmd , "rm home/fft_1_2_1_4096" );
     1216strcpy( cmd , "load bin/user/fft.elf" );
    12101217execute( cmd );
    12111218*/
     
    12521259#if DEBUG_INTER
    12531260unsigned int pid = getpid();
    1254 snprintf( string , 128 , "\n[ksh] %s : request a new command", __FUNCTION__ );
     1261snprintf( string , 128 , "[ksh] %s : request a new command", __FUNCTION__ );
    12551262display_string( string );
    12561263#endif
     
    12821289                        count++;
    12831290#if DEBUG_INTER
    1284 snprintf( string , 128 , "[ksh] %s : get command <%s> / &log = %x / ptw = %d / &ptw = %x",
    1285 __FUNCTION__, cmd , log_entries[ptw].buf , ptw , &ptw );
     1291snprintf( string , 128 , "[ksh] %s : get command <%s>", __FUNCTION__, cmd );
    12861292display_string( string );
    12871293display_vmm( 0 , 2 );
     
    14521458
    14531459#if DEBUG_MAIN
    1454 printf("\n[ksh] main thread started on core[%x,%d]\n", cxy , lid );
     1460snprintf( string , 128 , "\n[ksh] main thread started on core[%x,%d]\n", cxy , lid );
     1461display_string( string );
    14551462#endif
    14561463   
     
    14631470
    14641471#if DEBUG_MAIN
    1465 printf("\n[ksh] main initialized semaphore\n" );
     1472snprintf( string , 128 , "\n[ksh] main initialized semaphore\n" );
     1473display_string( string );
    14661474#endif
    14671475   
     
    14761484                    NULL );
    14771485#if DEBUG_MAIN
    1478 printf("\n[ksh] main thread launched interactive thread %x\n", trdid );
     1486snprintf( string , 128 , "\n[ksh] main thread launched interactive thread %x\n", trdid );
     1487display_string( string );
    14791488#endif
    14801489
Note: See TracChangeset for help on using the changeset viewer.