<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>The threading, GC and TCP/IP are required by my software, so they have to be implemented, the question is what is the minimum required to implement them. No other OS services are required, and no OS would be installed. Some external libraries would be required, like a TCP/IP stack, but those are available without OS dependencies.</div><div><br></div><div>The target system is the Samsung Exynos 4 Quad SoC. It has a 4 ARM Cortex-A9 cores running at 1.6GHz and 2GB integrated DRAM.</div><div><br></div><div>Added to that would be a gigabit ethernet port. The whole system would have a maximum power draw of something like 5W.</div><div><br></div><div>The manual can be found here for those interested: </div><div><br></div><div><a href="http://www.samsung.com/global/business/semiconductor/file/product/Exynos_4_Quad_User_Manaul_Public_REV100-0.pdf">http://www.samsung.com/global/business/semiconductor/file/product/Exynos_4_Quad_User_Manaul_Public_REV100-0.pdf</a></div><div><br></div><div><br></div><div>The idea is to build a low cost, low power computing node that can deployed in large numbers. It would only run one threaded application and all I/O would be through the network port, so the OS would do little else than create overhead.</div><div><br></div><div>So far, aside from hardware initialization, I know I'd have to write a timer interrupt for user threads, some code to assign threads to cores, and an implementation of mmap/munmap, but I imagine not a full one since from what I understand only some of the functionality is used to catch access to various parts of memory.</div><div><br></div><div>I know I'd have to remove the many parts of m3core, libm3 and other libraries that reference OS services.</div><div><br></div><div><br></div><br><div><div>On Jan 4, 2013, at 9:08 AM, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; "><div dir="ltr">What is the system?<br><br><br><br>It is possible to not need memory allocation or threading or garbage collection.<br>You could use just globals and/or locals.<br><br><br><br>It is possibe to not need garbage collection.<br>Use unsafe and new/dispose for dynamic allocation.<br>The garbage collector for example, doesn't need garbage collection.<br><br><br><br>It is possible to not need threads.<br>It is obvious how.<br>But be aware that "libraries", including the garbage collector, create threads.<br><br><br><br>Anyway, "yes".<br>There are currently three usermode thread implementations.<br> 1) "get/set/make/swapcontext"<span class="Apple-converted-space"> </span><br> 2) "sigaltstack"<span class="Apple-converted-space"> </span><br> 3) "setjmp/timers"<span class="Apple-converted-space"> </span><br> This looks currently unused, and maybe deleted.<br><br><br><br>I guess they all user timers.<br><br><br><br>To start, see:<br><br> <span class="Apple-converted-space"> </span><br> jbook2:src jay$ pwd<br> /dev2/cm3/m3-libs/m3core/src<br><br> <span class="Apple-converted-space"> </span><br> jbook2:src jay$ find . | grep c$ | grep -i thread<br> ./thread/POSIX/ThreadPosixC.c<br> OR<br> ./thread/PTHREAD/ThreadPThreadC.c<br><br><br><br>Really, providing pthreads wouldn't be a bad idea.<br><br><br><br>For memory allocation, we use at least calloc, free, maybe malloc,<br>and mmap/munmap. You could probably replace mmap/munmap with calloc/malloc/free.<br><br><br><br>If you really want to link all of m3core and libm3, you'll<br>need more, open/close/read/write, fork or vfork/exec.<br><br><br><br>The way to know is probably just to try it.<br>Do you have a working C compiler/libraries/headers?<br>Can you just try it?<br><br><br>nm against cm3 is probably useful.<br>Some of these might be injected by "startup" code.<br>Some are wrappers for other code to use -- might not be used.<br>Some are implementation details of the C library.<br><br><br> nm /cm3/bin/cm3 | grep " U " <span class="Apple-converted-space"> </span><br><br><br> U ___error<br> U ___gxx_personality_v0<br> U ___sF<br> U ___stderrp<br> U __exit<br> U __longjmp<br> U __setjmp<br> U _abort<br> U _access<br> U _calloc<br> U _ceil<br> U _chdir<br> U _close<br> U _closedir<br> U _dup2<br> U _execve<br> U _execvp<br> U _exit<br> U _fcntl<br> U _feclearexcept<br> U _fegetround<br> U _feraiseexcept<br> U _fesetround<br> U _fetestexcept<br> U _fflush<br> U _floor<br> U _fork<br> U _fprintf<br> U _free<br> U _fstat<br> U _fsync<br> U _fwrite<br> U _getcwd<br> U _getdtablesize<br> U _getegid<br> U _getenv<br> U _geteuid<br> U _gethostname<br> U _getpid<br> U _gettimeofday<br> U _gmtime<br> U _kill<br> U _ldexp<br> U _link<br> U _llroundl<br> U _localtime<br> U _lseek<br> U _lstat<br> U _malloc<br> U _memcmp<br> U _memmove<br> U _memset<br> U _mkdir<br> U _mktime<br> U _mmap<br> U _modf<br> U _nanosleep<br> U _open<br> U _opendir<br> U _pipe<br> U _poll<br> U _pthread_atfork<br> U _pthread_attr_destroy<br> U _pthread_attr_getstacksize<br> U _pthread_attr_init<br> U _pthread_attr_setstacksize<br> U _pthread_cond_broadcast<br> U _pthread_cond_destroy<br> U _pthread_cond_init<br> U _pthread_cond_signal<br> U _pthread_cond_timedwait<br> U _pthread_cond_wait<br> U _pthread_create<br> U _pthread_detach<br> U _pthread_equal<br> U _pthread_getspecific<br> U _pthread_key_create<br> U _pthread_kill<br> U _pthread_mach_thread_np<br> U _pthread_mutex_destroy<br> U _pthread_mutex_init<br> U _pthread_mutex_lock<br> U _pthread_mutex_unlock<br> U _pthread_self<br> U _pthread_setspecific<br> U _read<br> U _readdir<br> U _readlink<br> U _rename<br> U _rmdir<br> U _sched_yield<br> U _sigaction<br> U _sigsetjmp<br> U _sleep<br> U _stat<br> U _strcmp<br> U _strtod<br> U _symlink<br> U _thread_abort_safely<br> U _thread_get_state<br> U _thread_resume<br> U _thread_suspend<br> U _time<br> U _tzset<br> U _uname<br> U _unlink<br> U _utimes<br> U _waitpid<br> U _write<br><br><br><br> - Jay<br><br><br><br><br><div><div id="SkyDrivePlaceholder"></div>> From:<span class="Apple-converted-space"> </span><a href="mailto:darko@darko.org">darko@darko.org</a><br>> Date: Fri, 4 Jan 2013 01:16:47 -0800<br>> To:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> Subject: [M3devel] Bare Metal Modula-3<br>><span class="Apple-converted-space"> </span><br>> I'm interested in deploying M3 into a kind-of embedded environment where efficiency and performance are key and I want to avoid installing an OS beyond a simple supervisor that manages the hardware.<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> The services needed are threading, memory allocation and network access. I'm figuring the first two already exist in M3 and a network stack can be found.<br>><span class="Apple-converted-space"> </span><br>> The question I have is can all of the OS specific runtime can be removed? Beyond maybe a timer and possibly some memory protection functionality, what does M3 need to run threading and garbage collection?<br>><span class="Apple-converted-space"> </span><br>> - Darko<br>><span class="Apple-converted-space"> </span><br></div></div></div></blockquote></div><br></body></html>