:: Re: [DNG] Custom OS initiator. In n…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Steve Litt
Fecha:  
A: dng
Asunto: Re: [DNG] Custom OS initiator. In need of some hints...
On Tue, 14 Jun 2016 08:54:12 +0200
Edward Bartolo <edbarx@???> wrote:

> According to my logic the endless loops should be at the
> end rather than at the middle of the code.


You need to write several programs using fork(). After a call to
fork(), there are two copies of that same program running, the main
difference between them is the PID and the return value of fork(). Look
at the fork() man page.

> Furthermore, the code seems
> to first block signals then it enables them back afterwards
> contradicting the text.


Pre-cisely! The fact that it splits into two processes makes it
non-linear. If fork() returns non-zero, then your current process is
the original. If the return is zero, you're in the child process. Write
a few programs using fork(), and experiment with it. On an experimental
computer you don't care about, write a fork() bomb program to consume
all resources. It's fun and educational, but don't do it on a computer
whose data you care about.

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb