Changes between Version 1 and Version 2 of DiffFromUnix
- Timestamp:
- 2011-06-11T20:25:56Z (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DiffFromUnix
v1 v2 1 = Design differences from U nixand POSIX systems =1 = Design differences from UN*X and POSIX systems = 2 2 3 3 == No `fork()`, no `exec()` == 4 4 5 In traditional U nix, 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.5 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. 6 6 7 7 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()`. 8 9 == Running in background == 10 11 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. 8 12 9 13 == No signals ==