Changes between Version 19 and Version 20 of almosOnTsarDoc


Ignore:
Timestamp:
Aug 21, 2012, 2:55:10 PM (12 years ago)
Author:
almaless
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • almosOnTsarDoc

    v19 v20  
    6060''Sim1'' rule means the simulator of TSAR is configured to one cluster, that is, 4 cores. Using ''sim4'', ''sim16'', ''sim64'' or ''sim128'' lets you start the simulator with (respectively) 4, 16, 64 or 128 clusters of 4 cores each.
    6161
    62 '''Note''': although the hardware configuration can be changed at each simulation, there is no need to recompile or regenerate the kernel. The kernel of ALMOS detects the hardware resources at each boot. A user application can get the number of online cores using the standard ''sysconf'' call (man sysconf).   
     62'''Note''': although the hardware configuration can be changed at each simulation, there is no need to recompile or regenerate the kernel. The kernel of ALMOS detects the hardware resources at each boot. A user application can get the number of online cores using the standard ''sysconf()'' call (man sysconf).   
    6363
    6464Now lets take a look inside the ''DISTRIB/test/pf1'' directory.
     
    8686 4. Go to your ''DISTRIB/test/pfX'' directory and run the TSAR simulator
    8787 
    88 Some example of applications source code can be found in ''DISTRIB/apps''. Lets try the ''hello_world'' one. The ''main'' function of this application asks the system for the number of online cores (''count'') and then it fires ''count'' threads before it synchronizes on their end. Each fired thread executes the ''thread_func'' function which prints a "Hello World" message.
     88Some example of applications source code can be found in ''DISTRIB/apps''. Lets try the ''hello_world'' one. The ''main()'' function of this application asks the system for the number of online cores (''count'') and then it fires ''count'' threads before it synchronizes on their end. Each fired thread executes the ''thread_func()'' function which prints a "Hello World" message.
    8989
    9090To Cross-compile the application using ALMOS headers and static libraries:
     
    170170
    171171 1. Redirecting the simulator ttys output to files
    172  2. Write a mini script to let the shell automatically executes your programs
    173 
    174 
    175    
    176 TBD ...
     172 2. Write a mini-script to let the shell automatically executes your programs
     173
     174To do the first step you have to set an environment variable ''SOCLIB_TTY'' as fallows:
     175
     176{{{
     177$ export SOCLIB_TTY=FILES
     178}}}
     179
     180Now, lets go to ''DISTRIB/test/pf1'' directory and edit a new ''shrc'' script with the following contents:
     181
     182{{{
     183echo started
     184echo exec /bin/hello
     185exec /bin/hello
     186echo ended
     187}}}
     188
     189This can be done as follows:
     190
     191{{{
     192$ cd DISTRIB/test/pf1
     193$ cat > ./shrc
     194echo started
     195echo going to exec /bin/hello
     196exec /bin/hello
     197echo ended
     198^D
     199}}}
     200
     201Lets show the ''./shrc'' contents before coping it to ''/etc/shrc'' on ALMOS file system image ''hdd-img.bin'':
     202
     203{{{
     204$ cat ./shrc
     205echo started
     206echo going to exec /bin/hello
     207exec /bin/hello
     208echo ended
     209$ mcopy -i hdd-img.bin ./shrc ::/etc/.
     210}}}
     211
     212'''Note''': the ''shrc'' file name and the ''/etc'' destination directory are required by the shell of ALMOS. The first user process executed by the kernel of ALMOS is ''/bin/init'' which forks and execs the shell ''/bin/sh''. The ''sh'' will systematically look for ''/etc/shrc'' configuration file and executes all of its commands.
     213
     214Now, we are ready to run the TSAR simulator for a while before killing it and inspecting the generated files:
     215
     216{{{
     217$ make sim1
     218^C
     219}}}
     220