2.1 IntroMultithreading.pdf

(1554 KB) Pobierz
Introduction to Multithreading
When we run a program , the running program is called
‘Process’
A running program(process) will have its own flow of control
When a
single process
is running then its called
“uni-tasking”
When
more than one process
is running then its called
“Multitasking”
If two programs are running simultaneously then theses two programs will have
its own flow of control
Hardware( CPU) will execute some lines of program 1 then some lines of
program 2 then again 1 then 2 so on… this gives us the impression that they
are running simultaneously but only one core I.e, CPU will execute these
programs at a time
Multithreading
is same as multitasking but the difference is , in a main
program they are sub independent program that run simultaneously and each
sub program is having its own flow control.
they are children of main program.
A process is a heavy process , but a thread is a light weighted process because
Advantages of Multithreading :
-
We can create animations
-
We can create games
-
Chatting between multiple users
-
Providing web services for multiple clients connected to the server at a time
Zgłoś jeśli naruszono regulamin