Is it better to use threads or fork in the following case

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun May 3 23:38:56 CEST 2009


En Sun, 03 May 2009 17:45:36 -0300, Paul Hankin <paul.hankin at gmail.com>
escribió:
> On May 3, 10:29 pm, grocery_stocker <cdal... at gmail.com> wrote:
>> On May 3, 1:16 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
>> > grocery_stocker schrieb:

>> > > Would it be better to use threads to break this up? I have one  
>> thread
>> > > download the data and then have another to actually process the  
>> data .
>> > > Or would it be better to use fork?
>>
>> > Neither. Why do you think you need concurrency at all?
>>
>> Okay, here is what was going through my mind. I'm a 56k dialup modem.
>> What happens it takes me 15 minutes to download the file? Now let's
>> say during those 15 minutes, the program needs to parse the data in
>> the existing file.
>
> If your modem is going at full speed for those 15 minutes, you'll have
> around 6.3Mb of data. Even after decompressing, and unless the data is
> in some quite difficult to parse format, it'll take seconds to
> process.

In addition, the zip file format stores the directory at the end of the  
file. So you can't process it until it's completely downloaded.  
Concurrency doesn't help here.

-- 
Gabriel Genellina




More information about the Python-list mailing list