|Proposed by Geronimo Forconi (profile, biography)
Event based library integration in Pharo image and VM
An Event-Driven Library implements the architecture where the flow of the program is determined by the events its receives. Its functionallity could be divided on twe sections: the event selection or detection, and the event handling. All this operations are done asynchronous and non-blocking, asynchronous because the application expressed interest at one point, then used the data at another point (in time and space). It is non-blocking because the flow of the program continues and don't wait to finish the event is processing (continues with other events). Libuv is a library that implements this functionality.
The project idea aims to implement the libuv library in Pharo. Actually Phraro VM is not Multithread, so it will be needed to analyze how this library will be implemented to know the scope of ussage and to prepare it for a future integration on a Multithread VM. For the library implementation will be necesary to:
Implement suitable interface on the image, to connect with the libuv library.
Implement a VM Plugin to use the library.
Description and Technical Information.
In event-driven programming, an application expresses interest in certain events and respond to them when they occur.
It will be necesary to implements an event loop to get and handle the events registered. This event loop runs forever. Libuv implement the uv_run() for this.
The events could be triggered by the Operative System or by any application. Some examples of events are: Sockets ready to read data, Files ready to write, timers.
We will have Watchers, that express interests in particular events, libuv library support many watcher types, they are:
typedef struct uv_loop_s uv_loop_t;
typedef struct uv_err_s uv_err_t;
typedef struct uv_handle_s uv_handle_t;
typedef struct uv_stream_s uv_stream_t;
typedef struct uv_tcp_s uv_tcp_t;
typedef struct uv_udp_s uv_udp_t;
typedef struct uv_pipe_s uv_pipe_t;
typedef struct uv_tty_s uv_tty_t;
typedef struct uv_poll_s uv_poll_t;
typedef struct uv_timer_s uv_timer_t;
typedef struct uv_prepare_s uv_prepare_t;
typedef struct uv_check_s uv_check_t;
typedef struct uv_idle_s uv_idle_t;
typedef struct uv_async_s uv_async_t;
typedef struct uv_process_s uv_process_t;
typedef struct uv_fs_event_s uv_fs_event_t;
typedef struct uv_fs_poll_s uv_fs_poll_t;
typedef struct uv_signal_s uv_signal_t;
The library also implements functions to handle FileSystem, Networking, threads and Processes. It will be necesary to detect what and how the functions of each topic could be implemented, as some Threads or Processes could not be achieved currently by the VM as it only has one Object Interpreter to handle the asynchronous processing. But it will be necesary to give an interface to easily handle them with a Multithread VM.
All functions have two forms, synchronous and asynchronous.
Functions for Reading/Writing files.
Standard Files operations (like unlink, rmdir, stat, etc).
Buffers and Streams.
File change Events.
It is similar to the BSD socket interface.
Socket servers functions.
Managing UDT and TCP protocols.
Core thread operations (create, join, destroy)
Synchronization (mutex, locks, etc)
Childs Processes management.
Spawning child processes.
Managing Process paramenter (environment variables, flags, etc)
For multhread VM there are several topics to discuss, like having the threading model inside or outside the vm, if it will be needed to fork the interpreter for each processor, how to handle each thread, blocking, comunicating, etc. This is a large discusion that is out of the scope of this project.
Benefits of this project
Having efficient event driven library available in Smalltalk would open possibility of writing efficient servers in Smalltalk that can handle large number of concurrent connections.
Also will help on knowledge of the investigation and discussion of the implementation of Multi Threaded VM, but for implementing it will be needed to study and evaluate some other areas.
Project's Time Schedule
This the spected Schedule that I will follow for the development. The dates range starts on Monday and finishes on Sunday, most of them have two weeks, and only one of them has three weeks.
Before starting on June 17
Read and familiarize with the Libuv library, and its implementations on other systems. Also read and understand the Squeak/Pharo VM, get in deep detail of how it works and how to make a plugin.
June 17 to June 30.
Start with the Plugin implementation of libuv. Implement the Event loop interface and watchers.
July 1 to July 14.
Implement the interface classes on the Image, to connect with the library.
July 15 to July 28.
Implement a simple Iddling timer example. This will be the first use of the system.
July 29 to August 11.
Implement FileSystem and Networking Functions on the Plugin.
August 12 to September 8.
Implement FileSystem, Networking, Threads and Process Functions on the Plugin.
September 8 to September 16.
Implement a Simple server example using that functions.
First names: Gerónimo
Place of birth: Chabas, Santa Fe, Argentina
Date of birth: 25 August 1988
Address: Corrientes 1551 3A
Cell phone: 341-3382636
High School: Instituto Técnico “San José” N°8163.
Location: Chabas, Santa Fe, Argentina
Street: Mariano Moreno 1567
- Técnico Electromecánico
- Producción de Bienes y Servicios
University School: Universidad Tecnológica Nacional Regional Rosario
Cursando el ciclo de formación (5to año) de la carrera Ingeniería en Sistemas de Información.
Location: Rosario, Santa Fe, Argentina
Street: ZEBALLOS 1341
Web Page Design.
2005 – 2006.- Atención al Público y Mantenimiento de Computadoras en “El Ciber de la Plaza” Mitre 1653 – Chabás.
2006.- Pasantías realizadas en “ENCAR S.R.L.” Mariano Moreno 1993 - Chabás. Realicé tareas de automatización en máquina perforadora con PLC.
2007.- Mantenimiento Aceitera Chabás – AGD - en la empresa contratista “Metalúrgica Chabás”
2008.- Mantenimiento Eléctrico en Planta Rural “Estancia Las Marías”.
Actualidad.- Programador en Psiware - Programando con Smalltalk, drupal y Pentaho.
* Conocimientos básicos, adquiridos en UTN FRRO y proyectos personales.