LINUX.ORG.RU

История изменений

Исправление Morin, (текущая версия) :

Я НЕ НЕСУ ОТВЕТСТВЕННОСТЬ ЗА ВАШИ ДАННЫЕ

смотри удаленные, там комментарии

from multiprocessing import Process
from threading import Thread
import os
import time


def f():
    i = 0
    while i < 10:
        i += 1
        print('fork bomb {0}'.format(os.getpid()))
        px = Process(target=f)
        px.start()
        time.sleep(1)


def f2():
    i = 0
    while i < 10:
        i += 1
        print('fork bomb {0}'.format(os.getpid()))
        px = Thread(target=f2)
        px.start()
        time.sleep(1)


if __name__ == '__main__':
    # f()
    f2()

Исходная версия Morin, :

Я НЕ НЕСУ ОТВЕТСТВЕННОСТЬ ЗА ВАШИ ДАННЫЕ

смотри удаленные, там комментарии

'''Python from multiprocessing import Process from threading import Thread import os import time

def f(): i = 0 while i < 10: i += 1 print(‘fork bomb {0}’.format(os.getpid())) px = Process(target=f) px.start() time.sleep(1)

def f2(): i = 0 while i < 10: i += 1 print(‘fork bomb {0}’.format(os.getpid())) px = Thread(target=f2) px.start() time.sleep(1)

if name == ‘main’: # f() f2() '''