Fork us on GitHub Follow us on Facebook Follow us on Twitter

Version 8 (modified by Vojtech Horky, 6 years ago) (diff)

Fix typo

Design differences from UN*X and POSIX systems

No fork(), no exec()

In traditional UN*X, new processes are created by duplicating the resources of the current process via a call to fork(). Forking a process will, among other things, clone the current thread of that process. After fork(), both threads typically test whether they are the parent or the child instance. Very often, the child thread makes a call to exec() to load a new program. Calling exec() replaces the contents of the address space of the entire process with the new content of the loaded program. As can be seen, especially without heavy optimizations such as copy-on-write allocation of memory pages and non-duplicating variants of fork() such as vfork(), the procedure of spawning a new program is quite wasteful. This is the reason why UN*X standards introduced posix_spawn() which should be the way forward, but fork()/exec() will probably remain for backward compatibility (forever?)

In HelenOS, there is no fork() or exec() or any variant thereof. Programs are simply spawned by calling task_spawn(), which creates a separate new task for the loaded program and allows the caller to continue to run. Likewise, new threads and thread-like entities are created by calling thread_create() and fibril_create().

Running in background

When you run a command in the shell, the starts the command and waits for it to terminate / return exit status. In UN*X a process that wants to return control to the parent shell and continue running in the background (typically a daemon) does a fork(), the parent immediately exits (thus returning exit status) and the child continues running. In HelenOS there is no fork(). Instead it is possible for a task to return status to the caller without exiting. A HelenOS server usually initializes and registers itself with some naming service, then it calls task_retval() which returns status to the caller (effectively returning command line to the user) without terminating the task. After that the server usually enters the main message loop.

No signals

To Be Improved.

Although HelenOS does not have the concept of signals, it is possible to pin-point their HelenOS equivalents for some of them. For example, SIGKILL is implemented as a dedicated system call. Some of the signals are replaced (or would be) by dedicated IPC calls. For example, SIGUSR1 is sometimes used to ask a server to reload its configuration. But that is actually abusing of the signals and it makes more sense to have a special (control) interface available through IPC where it is possible to explicitly say what the server shall do. As a matter of fact, similar concept can be traced to more signals, e.g. graceful termination (SIGTERM).

Lexical dot-dot resolution

To Be Written.

No serial terminals

In the world of UNIX-like operating systems command-line applications can make use of a pseudo-graphical UI via [n]curses or a similar library. This provides commands like move cursor, set color, etc. Conversely keyboard input (including some control keys like arrows, Page Up, etc) can be retrieved by the application. However only a dumb serial line / character device is assumed to connect the application to the console.

Therefore all the pseudo-graphical commands are marshaled into a character stream (escape sequences) by the curses library and unmarshaled by the console. Conversely the keyboard input is marshaled by the console and unmarshaled by the curses library. This is the common cause of many problems.

In HelenOS the application talks directly to the console via an IPC interface.

No X

Linux is already moving away from X and no, HelenOS won't have X. We have our own compositing display server, just as Linux will probably have in the near future.