[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Multithreaded application development
From:       Waldo Bastian <bastian () kde ! org>
Date:       2001-06-17 4:18:43
[Download RAW message or body]

On Saturday 16 June 2001 07:22 pm, Jeff brubaker wrote:
>   Does this mean that no applications included in the base distribution
> of KDE use threads at all?

I believe arts uses threads. But arts doesn't depend on KDE. I don't think 
any actual KDE application uses threads, but I'm not 100% sure.

>   When i click on a link in konqueror, it is able to respond to user
> events even as the page is loaded. Is this the same way I.E. and Netscape
> accomplish this? I always assumed that they all  used a threading
> based approach.

No.

>   I know that in the Task Manager in Windows NT there is a threads column,
> and most programs have a good number of threads in this column. How is it
> that KDE is able to get away with no threads and some windows programs
> have 20+ threads?

1) We use an event-based model. E.g. whenever we get a piece of data from the 
network it generates an event and that event is processed in the appropriate 
place. This has its limitation in the fact that if you get events that 
require a lot of processing you will not be able to process other events. 
Sometimes you will be able to notice this if you have two konqueror windows 
that are part of the same process.

The problem of expensive events can often be reduced by artificially 
splitting events up in smaller events. For example we limit the amount of 
data per event that is sent from the io-slaves to konqueror. On the down 
side, this makes processing slightly less efficient.

2) We off-load certain tasks to so called io-slaves that run in a seperate 
process. This is to prevent that our whole application can hang on I/O 
intensive operations or e.g. hostname lookups. Although it is theoretically 
possible to program this in an event-driven manner as well, it's much more 
practical to do this in a procedural way in a seperate process. From the 
io-slave the data is send to the application which in its turn processes this 
information in an event-driven way again.

Cheers,
Waldo
-- 
bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic