Changes between Version 19 and Version 20 of almosOnTsarDoc
- Timestamp:
- Aug 21, 2012, 2:55:10 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
almosOnTsarDoc
v19 v20 60 60 ''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. 61 61 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). 63 63 64 64 Now lets take a look inside the ''DISTRIB/test/pf1'' directory. … … 86 86 4. Go to your ''DISTRIB/test/pfX'' directory and run the TSAR simulator 87 87 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.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. 89 89 90 90 To Cross-compile the application using ALMOS headers and static libraries: … … 170 170 171 171 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 174 To do the first step you have to set an environment variable ''SOCLIB_TTY'' as fallows: 175 176 {{{ 177 $ export SOCLIB_TTY=FILES 178 }}} 179 180 Now, lets go to ''DISTRIB/test/pf1'' directory and edit a new ''shrc'' script with the following contents: 181 182 {{{ 183 echo started 184 echo exec /bin/hello 185 exec /bin/hello 186 echo ended 187 }}} 188 189 This can be done as follows: 190 191 {{{ 192 $ cd DISTRIB/test/pf1 193 $ cat > ./shrc 194 echo started 195 echo going to exec /bin/hello 196 exec /bin/hello 197 echo ended 198 ^D 199 }}} 200 201 Lets show the ''./shrc'' contents before coping it to ''/etc/shrc'' on ALMOS file system image ''hdd-img.bin'': 202 203 {{{ 204 $ cat ./shrc 205 echo started 206 echo going to exec /bin/hello 207 exec /bin/hello 208 echo 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 214 Now, 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