Ask Your Question

Revision history [back]

How does Linux handle my programs?

Hey guys, Im new to Linux, installed it just this past week (after like 2 days of complete struggle hahaha) Im on Fedora 24.

On my Programming Classes, all I do on Linux's Terminal, is compile stuff, and run .c codes... but I want to know, what exacly goes inside Linux when that happens...

I mean, I can compile and execute any sort of program? Even if it is dangerous for my computer? or does Linux/Fedora have some sort of safety check of some sort... I dont know if I made myself clear xD

and example, if I tried to run this programa here:

#include <stdio.h>
#include <unistd.h>

void forknator()
{
    if(fork() < 0)
    {
        return;
    }
    forknator();
}

int main()
{
    while(1)
    {
        forknator();
    }
    return 0;
}

I would be creating an endless number of processes... Honestly, I'm not exacly sure what creating an enormous amount of process would actually do to my PC (crash, slow, etc, idk...) but I know this program would be bad news for it... Would I even be able to run this program? Or I would get some sort of check? If I did run it... would I get any warnings? Would my OS do something to it? Or let it create new processes till the end of times??