Figyu, Rigidus, úgy látom, nem vagy tisztában a "thread" jelentésével!!! Ez egy fogalom, nem valami konkrét dolog!!! Azt jelenti: "tread of execution"! Azaz, a végrehajtás két szála, amik (látszólag, vagy igazából) párhuzamosan futnak. Lehet az két külön process, és lehet egy processen belül két szál! Amikor a fork()-kal duplikálunk egy processt, és a másolat [ami az elsõ memóriáját használja] külön szálon fut! Olyan utasítás nincs, ami egy "thread"-et indít el csak úgy magában!!!
Továbbá a multithreading és a multiprocessing fogalmakat is! Multiprocessing: ez nem a több process párhuzamos futtatását jelenti, hanem több processor használatát!
"A thread in computer science is short for a thread of execution. Threads are a way for a program to split itself into two or more simultaneously running tasks. (The name "thread" is by analogy with the way that a number of threads are interwoven to make a piece of fabric). Multiple threads can be executed in parallel on many computer systems. This multithreading generally occurs by time slicing (where a single processor switches between different threads) or by multiprocessing (where threads are executed on separate processors). Threads are similar to processes, but differ in the way that they share resources."
"1. Tobb szal != tobb process."
De! Ezt is jelentheti!
"2. Kivetel nelkul minden program "CPU-igenyes"."
Ez nem így van. Lehet írni olyan programot, ami csak akkor kapja meg a CPU-t egy rövid idõre, amikor a user hozzányúl a GUI-hoz, és egyébként "alszik".
"3. CPU-k kozotti elosztott szamitasrol volt szo nem pedig feladatok parhuzamos futtatasarol."
Adott esetben a kettõ ugyanaz.
"4. A srac hol beszelt szalakrol?"
Így már talán látod, hol.
" "Tehát a thread és a process közt az a különbség, hogy a thread-eknek lehetnek közös erõforrásaik (pl. memória), a process-eknek meg nem."
Pont ez az, hogy nem. Eleg nagy gaz lenne. Ha igy volna akkor a processek nem lennenek kepesek adatcserere."
Nono, ha olyan könnyen cserélgethetnék az adatokat, akkor nem lenne memóriavédelem! Minden processhez saját virtuális memória tartozik! Tehát egymás memóriaterületét még csak nem is látják.
Lásd:
"Memory protection is a system that prevents one process from corrupting the memory of another process running on the same computer at the same time. It usually employs hardware (i.e. a memory management unit) and system software to allocate distinct memory to different processes and to handle exceptions arising when a process tries to access memory outside its bounds.