T
T
tmvrus2012-09-16 21:46:11
linux
tmvrus, 2012-09-16 21:46:11

Why does this code hang Linux

Good time of the day.
Here in this topic , the author describes the "fork bomb"
and gives an example of code that "hangs" the server. Can anyone explain why the code
echo '. ./_&. ./_&'>_;. ./_
works this way.
Thank you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
Y
YourChief, 2012-09-16
@tmvrus

this code writes a file _with content

. ./_&. ./_&
and runs it in the current shell (. filename). the file itself calls itself twice as a background job and so recursively.

A
Andrey Burov, 2012-09-17
@BuriK666

It 's a fork bomb

T
tmvrus, 2012-09-16
@tmvrus

Can you be more specific about which part of the code is responsible for what?

A
apcsb, 2012-09-28
@apcsb

Try this one too:
: () { :|:& };:

D
demimurych, 2012-09-17
@demimurych

Does not hang, but eats up all resources. The system actually works but is so slow that it seems to be hanging.
On systems with properly configured ulimits nothing will happen.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question