Fork: Difference between revisions
Content added Content deleted
(Added Elixir) |
|||
Line 143: | Line 143: | ||
((plusp pid) (write-line "This is the original process.")) |
((plusp pid) (write-line "This is the original process.")) |
||
(t (error "Something went wrong while forking."))))</lang> |
(t (error "Something went wrong while forking."))))</lang> |
||
=={{header|DCL}}== |
=={{header|DCL}}== |
||
In OpenVMS DCL, spawning a subprocess creates a partially independent process. The parent and child processes share certain pooled quotas, certain shared resources, and if the parent process is deleted then the child process is too automatically. |
In OpenVMS DCL, spawning a subprocess creates a partially independent process. The parent and child processes share certain pooled quotas, certain shared resources, and if the parent process is deleted then the child process is too automatically. |
||
Line 186: | Line 187: | ||
4-JUN-2015 13:35:55 |
4-JUN-2015 13:35:55 |
||
4-JUN-2015 13:35:57</pre> |
4-JUN-2015 13:35:57</pre> |
||
=={{header|Elixir}}== |
|||
<lang elixir>defmodule Fork do |
|||
def start do |
|||
spawn(fn -> child end) |
|||
IO.puts "This is the original process" |
|||
end |
|||
def child, do: IO.puts "This is the new process" |
|||
end |
|||
Fork.start</lang> |
|||
{{out}} |
|||
<pre> |
|||
This is the original process |
|||
This is the new process |
|||
</pre> |
|||
=={{header|Erlang}}== |
=={{header|Erlang}}== |
||
Line 209: | Line 228: | ||
[ "Hello form child" print flush 0 _exit ] [ drop "Hi from parent" print flush ] with-fork</lang> |
[ "Hello form child" print flush 0 _exit ] [ drop "Hi from parent" print flush ] with-fork</lang> |
||
=={{header|Fexl}}== |
=={{header|Fexl}}== |
||
There are many levels at which I can address this task. I'll start from the lowest possible level: |
There are many levels at which I can address this task. I'll start from the lowest possible level: |