<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><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" <br> 2) "sigaltstack" <br> 3) "setjmp/timers" <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>  <br>  jbook2:src jay$ pwd<br>  /dev2/cm3/m3-libs/m3core/src<br><br>  <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 "  <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: darko@darko.org<br>> Date: Fri, 4 Jan 2013 01:16:47 -0800<br>> To: m3devel@elegosoft.com<br>> Subject: [M3devel] Bare Metal Modula-3<br>> <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. <br>> <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>> <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>> <br>> - Darko<br>> <br></div>                                       </div></body>
</html>