-
13-10-2011, 13:20 #1Approved 9liver
- Registered
- 21/08/08
- Location
- Mechelen
- Posts
- 5,952
- iTrader
- 30 (97%)
- Mentioned
- 0 Post(s)
- Reputation
- 0/4
Multithreading vs Single Thread Info
Hallo!
We moesten voor het school een programma multithread maken. Maar wat zijn hier dan de voordelen van?
Het enige wat ik moest doen is deel van de code in een aparte thread function zetten.
Maar ik zie geen verschil tussen single thread en multithread?
Greetz!StackOverflow Account
Pain is temporary. It may last a minute, or an hour, or a day, or a year, but eventually it will subside and something else will take its place. If I quit, however, it lasts forever.no votes
-
-
13-10-2011, 13:44 #2Member
- Registered
- 23/11/03
- Location
- Landeurp
- Posts
- 1,791
- iTrader
- 0
- Mentioned
- 0 Post(s)
- Reputation
- 10/17
Als je maar één CPU hebt: weinig of geen voordelen, tenzij dat je misschien je code iets logischer kan structureren (een bepaalde taak per thread).
Bij meerdere CPU's (of meerdere cores) kan je OS je threads hierover verdelen, wat logischerwijs een serieuze prestatiewinst oplevert.no votes
-
13-10-2011, 13:45 #3Approved 9liver
- Registered
- 21/08/08
- Location
- Mechelen
- Posts
- 5,952
- iTrader
- 30 (97%)
- Mentioned
- 0 Post(s)
- Reputation
- 0/4
StackOverflow Account
Pain is temporary. It may last a minute, or an hour, or a day, or a year, but eventually it will subside and something else will take its place. If I quit, however, it lasts forever.no votes
-
13-10-2011, 14:50 #4no votes
-
13-10-2011, 15:04 #5Approved 9-lifer
- Registered
- 30/09/02
- Location
- Kasterlee
- Posts
- 6,160
- iTrader
- 11 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 1/25
no votes
-
13-10-2011, 15:16 #6Approved 9-lifer
- Registered
- 27/08/04
- Location
- Leuven
- Posts
- 930
- iTrader
- 0
- Mentioned
- 0 Post(s)
- Reputation
- 11/38
I am thee and thou art me and all of one is the other.
TED talk: Richard Dawkins on militant atheismno votes
-
13-10-2011, 19:17 #7Approved 9liver
- Registered
- 18/01/04
- Location
- Melle
- Posts
- 10,535
- iTrader
- 56 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 27/102
Applicaties die meerdere users moeten kunnen bedienen hebben aan threads wel een groot voordeel. Je zou ook constant nieuwe processen kunnen spawnen, maar dat is ook duur. Ik denk bv. aan server apps die op inkomende sockets staan te luisteren.
“In terms of how we evaluate schooling, everything is about working by yourself. If you work with someone else, it’s called cheating. Once you get out in the real world, everything you do involves working with other people.”
PSN: Cycloon - Final Fantasy XIV: A realm reborn characterno votes
-
13-10-2011, 20:15 #8Approved 9liver
- Registered
- 21/08/02
- Location
- Roeselare
- Posts
- 4,474
- iTrader
- 15 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 1/35
een voorbeeld kan zijn: een website die in de main thread de pagina opbouwt, in een andere thread zorg je bijvoorbeeld voor logging van gebruikersstatistieken.
Principe van 1 thread voor de gui en andere threads voor achtergrondwerk, wordt heel veel toegepast, om de interface responsief te houden bijvoorbeeld.
Tegenwoordig ondersteunen zelfs smartphones multithreading, dus jano votes
-
13-10-2011, 20:59 #9Approved 9liver
- Registered
- 21/08/08
- Location
- Mechelen
- Posts
- 5,952
- iTrader
- 30 (97%)
- Mentioned
- 0 Post(s)
- Reputation
- 0/4
Thanks for the info! Ik zal hier over reflecteren met de rest van de klas
StackOverflow Account
Pain is temporary. It may last a minute, or an hour, or a day, or a year, but eventually it will subside and something else will take its place. If I quit, however, it lasts forever.no votes
-
13-10-2011, 23:57 #10Member
- Registered
- 20/06/05
- Location
- Gierle
- Posts
- 1,010
- iTrader
- 8 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 0/1
Ik ben nu een app aan het schrijven voor het Android telefoon. Zelfs daar wordt multithreading véél toegepast.
Ik moet bv een relatief groot bestand downloaden, moest ik dat allemaal in een single core stoppen zou je als gebruiker naar een freeze scherm staren terwijl hij bezig is.
Met multithreading kan je er voor zorgen dat de gebruiker nog op knoppen kan drukken terwijl de app in de achtergrond aan het downloaden is.
Bijna elk program doet multithreading (zoniet elk programma?)PSN: Hemphiusno votes
-
14-10-2011, 12:02 #11no votes

