
The script have to mods of running which are:
Normal MultiThreading, and, if this is a new tecnique, tell me for i put a name
Comparison:
(Balls and Shoot Exemple, i think is a good one, or not)
:Normal (Non - MultiThread)

:Fast (MultiThraeding)

:Very Fast (Multi - MultiThreading)

Normal Multithreding act like this, create some thraeds an then execute them in the same time, something like this:
Python Ex:
import threadingclass MyThread(threading.Thread): def __init__(self, func): threading.Thread.__init__(self) self.func = func def run(self): apply(self.func)def ball1(): for i in range(50): print 'ball 1 : shoot :',i + 1def ball2(): for i in range(50): print 'ball 2 : shoot :',i + 1funcs = [ball1,ball2]def main(): nfuncs = range(len(funcs)) print '\n*** MULTIPLE THREADS ***' threads = [] for i in nfuncs: t = MyThread(funcs[i]) threads.append(t) for i in nfuncs: threads[i].start() for i in nfuncs: threads[i].join() print '*** ALL DONE ***'if __name__ == '__main__': main()
Output:
ball 2 : shoot : 9ball 1 : shoot : 32ball 1 : shoot : 33ball 1 : shoot : 34ball 1 : shoot : 35ball 1 : shoot : 36ball 1 : shoot : 37ball 1 : shoot : 38ball 1 : shoot : 39ball 2 : shoot : 10ball 2 : shoot : 11ball 2 : shoot : 12ball 2 : shoot : 13
You see is fast but can't run the functions at the same time,
this way just make the script more fast.
Now Multi - Multi Threading, Multi - Multi (Why?), because he puts a thread in a thread, pratical exemple, i have too football balls and i will make 3 shoot, it simple shoots the two balls at the same time, and make the 3 shoots of which balls at the same time.
Python Ex:
import threadingclass MyThread(threading.Thread): def __init__(self, func): threading.Thread.__init__(self) self.func = func def run(self): apply(self.func)class BallMyThread(threading.Thread): def __init__(self, func, ball, i): threading.Thread.__init__(self) self.func = func self.ball = ball self.i = i def run(self): apply(self.func,(self.ball,self.i))def pt(ball,i): print "Ball",ball,": Shoot :",i + 1 def ball1(): threads = [] for i in range(50): t = BallMyThread(pt,'1',i) threads.append(t) for i in range(50): threads[i].start()def ball2(): threads = [] for i in range(50): t = BallMyThread(pt,'2',i) threads.append(t) for i in range(50): threads[i].start() funcs = [ball1,ball2]def main(): nfuncs = range(len(funcs)) print '\n*** MULTIPLE THREADS ***' threads = [] for i in nfuncs: t = MyThread(funcs[i]) threads.append(t) for i in nfuncs: threads[i].start() for i in nfuncs: threads[i].join() print '*** ALL DONE ***'if __name__ == '__main__': main()
Output:
Ball 1 : Shoot : 1Ball 1 : Shoot : 2Ball 2 : Shoot : 1Ball 1 : Shoot : 3Ball 2 : Shoot : 2Ball 1 : Shoot : 4Ball 2 : Shoot : 3Ball 1 : Shoot : 5Ball 2 : Shoot : 4Ball 1 : Shoot : 6Ball 2 : Shoot : 5Ball 1 : Shoot : 7Ball 2 : Shoot : 6
A thread in a thread.
Note: The script was tested in a Pentium 3 800Mhz 512mb Memory, using de simple MultiThread, and in 2min. the script test 24734 passwords, in Multi - MultiThreding the script test 22255, this because of the computer of tests.
Download Log of MultiThreading : MThread.txt
Download Log of Multi - MultiThreading : MMThread.txt
Download Script: bMySQL.py (310 lines of code, 12.537 bytes)
Questions, Erros, just post.












