[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Hjärn-släpp ??



"Joachim Holst (QCS)" wrote:
> Så det är det det handlar om. Då har jag troligen tänkt lite fel.

Fork er en meget mystisk funktion! Fordi du essentielt opretter
en kopi af det kørende program, med en kopi af alle variabler, og
fortsætter med at udføre både originalen (parent) og den nye kopi
(child). Den eneste forskel mellem de to programmer er det Pid
nummer som fork returnere.

Så hvis programmet er meget stort så er det måske smartere at
bruge threads, istedet for forks.

> Min tanke var att main skulle skapa Class1 och Class2 som sedan
> skulle kunna leva ett tag och prata med varandra.

Yep. Men når du fork'er så lever klass c1 og c2 vidre i begge
grene af programmet. Og både c1 og c2 read og write udføres i
begge grene af programmet.

> Hade tänkt använda det i ett program som har ett
> antal olika klasser (QT/KDE) som i sin tur skall prata med en 
> kommunikationsklass. De olika klasserna skall ta emot/skicka
> olika data.
 
Det er nok bedre at bruge threads. Hvor du har en thread der
står og modtager data. Samtidig med at du har andre threads
der asynkront afsender data. 

> Detta här verkar vara väldigt seriellt (först den ena och sedan den andra).

Nej. Fordi true branch i if sætningen udføres af child samtidigt
med at false branch i ifsætningen udføres af parent processen.
Så de to processer kører parallelt.

-- 
	Sometimes it's better to light a       Carsten Svaneborg
      flamethrower than curse the darkness.      sslug@sslug
	-- (Terry Pratchett, Men At Arms)    Fight Bill - use Linux


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *