Pino Zollo ha scritto: > Alle 06:10, sabato 6 settembre 2008, Benoit Minisini ha scritto: > >> Gambas interpreter was not designed to be multi-threaded at all. >> >> What sort of background process people want to do during their application? >> I never had such a need. >> > > When the applications does a lot of asynchronous input/output background > processes simplify a lot the programmer's life and, possibly, the resilience > of the full application. > > You can think to objects as hardware components interconnected like chips on > the motherboard. > Every one does his task and receives or sends data to other "objects" via a > pipe in place of a copper wire. > When tcp/ip is involved any new connection on the same address, the same > piece > of code is instantiated handling the new connection, letting the kernel the > task of distributing the CPU power. > > Just for having a look to applications that use heavily multitasking (or > multi > threads), my old applications in Modula-3 are available on my site > (http://www.qsl.net/zp4kfx/Linux ) > > How these features can be implemented in GAMBAS I do not know not having any > idea about how it is implemented. > > At the time of CP/M (does somebody remember it ?) and when the Z80 was > running > a 4 MHz, a wonderfull programming language, named FORTH, had a good success > and had a profound impact on my way of tinking programs...even now my gambas > program is conceived with the same logic. > The BASIC of the HP-85 did share the same style: > Every line of BASIC code was compiled, like FORTH, as a sequence of addresses. > The interpreter had just to call in sequence those addresses. > > In such a kind of BASIC multitasking is implemented easily. (In FORTH too). > > and....yes I started with punched cards ;-) > Dear Pino,
it is a pleasure for me to read about Z80, CP/M, Forth, HP-85 and so on. Like you, I started to program well before the PC was invented. But times are changed. Benoit is right when he says he never felt the need for multitasking; a correctly implemented event system can solve almost any problem. If you need a lot of TCP/IP sockets to keep running many connections, then you instantiate many "TCP socket object"s, with their event handler. When data arrive, the event handler sends reply. When data can be sended, another event handler is invoked, which sends data. No CPU time is wasted. The same can be done with files (not sure whether gambas can do non-blocking I/O on common files but, if it can not, it is another kind of problem). Modern approach is to eliminate polling and slow things, and replace them with events. Twenty years ago we did not have OOP and event driven applications. It is true that an advanced application can be written more easily having multithreading, but those advanced applications are very few, compared to the total number of application currently written in gambas. Asking for true multithreading is like asking for complex numbers: gambas does not have them, but still you can write an application which copes with them - this application will be more difficult to write, but will work pretty the same. Once again, I would say that multithreading is, in some way, in contrast with the event-driven paradigm. On the other hand, if gambas had multithreading, complex numbers, and other nice things, nobody would complain... Ciao, Doriano Blengino ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
