why won't this code eat up my resources..
Results 1 to 5 of 5

Thread: why won't this code eat up my resources..

  1. #1
    Banned
    Join Date
    Aug 2004
    Posts
    534

    why won't this code eat up my resources..

    shouldn't it multiply and slow down my system.

    int main(){
    int x = 1;
    while(x){
    int fork(void);
    }
    return 0;
    }

  2. #2
    Computer Forensics
    Join Date
    Jul 2001
    Posts
    672
    try this for a fork bomb.
    #include <unistd.h>

    int main(void)
    {
    while(1) {
    fork();
    }
    return 0;
    }
    Antionline in a nutshell
    \"You\'re putting the fate of the world in the hands of a bunch of idiots I wouldn\'t trust with a potato gun\"

    Trust your Technolust

  3. #3
    Senior Member
    Join Date
    Oct 2002
    Posts
    1,130
    ummm... I may be just being stupid here...

    But I don't see any functional difference between those, aside from the #include, which I assume unhappy simply didn't paste.

    What's the difference?
    Government is like fire - a handy servant, but a dangerous master - George Washington
    Government is not reason, it is not eloquence - it is force. - George Washington.

    Join the UnError community!

  4. #4
    Junior Member
    Join Date
    Mar 2005
    Posts
    25
    what's that? please give a brief intro...
    buat baik berpada-pada,buat jahat jangan sekali

  5. #5
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi

    While the first example by unhappy simply declares a function fork()
    with "void fork(int);" the second by hogfly actually calls system's
    fork()-function thus spawning a child process.

    Cheers
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •