xtreams

Generators for Xtreams

While at Smalltalk Solutions 2011 in Las Vegas, a question was raised about Generators. Martin and I had no idea what Generators were, so we filed that one away for “later pontification”. Well, that later came this week when Nicolas Cellier posted about using generators and Xtreams to compute primes. One criticism Nicolas raised was the lack of Generators in Xtreams. We wanted to understand what Generators were and why they needed to manipulate the stack to work. In the end, we decided it’s actually faster and easier to implement them using a second process and a couple of semaphores. Also, more portable. So what do generators do? Well, possibly the simplest example is this: 1 to: 10 do: [:i | …do something…] In this case, you cannot easily transform it in to a stream using [] reading, because you get stuck inside the iteration block, controlled by the #to:do: method. A generator allows you to push out elements piece-meal regardless of the nature of the code you’re running, eg: readStream := [:out | 1 to: 10 do: [:i | out put: i ] ] reading The block will begin running immediately, but as soon as it tries to write out a value on to the @out variable, it will halt execution until you attempt to read from @readStream. This makes it possible for Nicolas to re-write his example as: primes := [:out | Integer primesUpTo: 100 do: [:prime | out put: prime ] ] reading. Note that @out is actually a write stream, so you can use all the regular streaming API on it too, such as #write: instead of a single element #put:. The last part of this story isn’t to do with generators at all, but about using buffers to make non-positionable information positionable. In the case of Nicolas’s primes, he wanted the last element on the stream. You can’t “skip to end, rewind one, read last element” on a non-positionable stream. But you can on a positionable stream. The default buffer of a positionable stream is endless though, so it will record everything, allowing you to rewind right back to the start. In this case, that’s a complete waste. We also only produce one element at a time, because it’s coming from a generator. So, we can use a RingBuffer of size 1 as the buffer for positioning. (primes positioning buffer: (RingBuffer new: 1 class: Array))
    -= 1;
    get This is where the positioning API of Xtreams really becomes handy. We use #-= which means “From the end of the stream, rewind ‘n’ elements”. Now that we have a positioning buffer that always remembers the last element, we can skip to the end and rewind by one element and then call #get to fetch it. The [:out | ] reading generator terminal is available in XtreamsDevelopment 508.

instagram

[Xtream FM Venezuela] JACK Ü LANZA EL VÍDEO OFICIAL DE ‘WHERE ARE Ü NOW’ CON JUSTIN BIEBER … El dúo de música electrónica Jack Ü ya presentó hace unas semanas Where are Ü now, en colaboración con Justin Bieber, como segundo sencillo de su álbum Skrillex and Diplo present Jack Ü, y ahora lanzan el vídeo oficial. Disfruta de esta psicodelia de imágenes que acompañan al que seguro será uno de los temas claves de este año … http://xtreamfmvzla.blogspot.com/ #InstaMusic #InstaNews #ParaGenteComoTU #XtreamFMvzla #JustinBieber #JachÜ (en Acarigua-Araure)

@nyxcosmetics haul. Two Angled Brushes (#B22), two Baked Eyeshadows in Mademoiselle and Vortex, Xtream Shine Lip Cream in Buttery Nude, Nude Matte Eyeshadow, Concealer in Beige, Gel Liner in Jet Black, Tame & Frame Tinted Brow Pomade in Brunette, Tinted Brown Mascara in Brunette, Born To Glow Liquid Illuminator in Sunbeam, and Pore Filler. Amazing deal @ultabeauty #makeup #nyxcosmetics #ultabeauty

♤WAKEBOARDING ♡
Don’t sit at home getting bored!
Go Boarding!
#watersport #wakeboard #wakeboarding #instasurf #waterskies #windsurf #windsurfer #fun #plaisir #beach #plage #xtream #paradis #paradise #picoftheday #photographer #pickoftheweek #sunnysideoflife #dhiffushi #maldives @studio8apps (at Dhiffushi Beach)

Polycephaly finds new home in Xtreams-Grid

When I first proposed Polycephaly to Arden Thomas, the product manager, and wrangled Martin Kobetic in to help me; I was unsure if we were really going to help our customers solve real world problems with it or not. Polycephaly, meaning “Many Heads” is a framework like Squeak’s Hydra. It lets you run multiple Smalltalk Images simultaneously, with one image controlling the “drones”. Ironically, the drones run headless, so despite it being called Many Heads it really should have been called Many Headlesses. To our delight, customers started emailing in with reports of its usefulness in their development and production environments. We also got a lot of feedback too. Polycephaly used stdin/stdout to communicate over pipes between the master and drone. Any customer code that just so happened to write out to Stdout or read from Stdin would break Polycephaly. Customers found it very useful to spawn 3-5 extra images and give them work to better utilize their multi-core machines. But they also wanted to do the same over the network. And so, Polycephaly-NetworkVirtualMachine was published by Holger Kleinsorgen. Another criticism was how VirtualMachines worked; specifically it was not useful as a load balancer. So Runar Jordahl blogged about his solution, which round-robin’d “jobs” to different VirtualMachine instances. Meanwhile, I was somewhat unimpressed with the inability for a drone to respond in a streaming fashion back to the master; or for the master to supply job objects in a stream either. This meant that as soon as a drone had completed its job, it would typically lock up in communication with the master through BOSS. So, the technical debt on Polycephaly finally reached a turning point when a review was written on the VWNC mailing list and I was resolved to fix the problems. And what luck, I had an engineering trip planned to travel to Ottawa where two of my colleagues live, and then to Victoria (Vancouver Isle.) where another one of my colleagues live. It just so happens that these colleagues could help me and face to face time is invaluable. I present to you Xtreams-Grid, a VisualWorks and ObjectStudio solution for working with multiple images on your local machine and across a network. Here is the features list when compared with Polycephaly:

  • Remove drones and remote masters. Drones can be activated via inetd style, or be pre-configured. Drones can connect to a pre-determined master, or be listening for a master(s) to connect.
  • Sockets instead of Pipes, no more Stdin/Stdout breaking the system.
  • Streaming results and arguments to-and-fro. The stream is now multiplexed too, with high through-put using the Xtreams-Multiplexer protocol.
  • VirtualMachines now acts as a load balancer with a “job” style API and can easily be used with #promise.
  • When starting a VirtualMachine locally, you can specify a different image to use and/or a different virtual machine executable.
  • Xtreams-Grid has actual documentation, where Polycephaly was still a work-in-progress and had none.
  • If you have the Xtreams parcels available (they will be updated in VisualWorks 7.9 at some point in the nearish future); an image no longer has to be saved, the Xtreams drone script will auto-load Xtreams-Grid and its prerequisites on start up.
It also has a much more sensible name. Every one knows what grid computing is and typically looks up ‘grid’ when trying to find it. Polycephaly, while having a very unique name that is highly recognizable, was always a bit of a tongue in cheek job. You can consider it as a past-tense code name at this point. The API of Xtreams-Grid is very similar to Polycephaly, though not 100% the same. There’s no #timeout:do: method any more, since you can use [] onTimeout: aDuration do: aBlock. VirtualMachines is a complete rewrite and the #do:environment: API is gone completely. There are new tricks up its sleeve though. Consider, for a moment, this peculiar little example: evens := machine do: [ :odds | odds collecting: [ :e | e + 1 ] ] with: (1 to: 9) reading. In this case, we are streaming in odd numbers to the drone and the drone will increment each element in the stream by one, then stream the results back out to the master. The master can leisurely read results, only taxing the drone as required. As well as this, the drone can consume multiple streams as arguments from the master. It does not need to consume each argument stream in full; since underneath the hood is the Xtreams-Multiplexer protocol, which works similarly to the SSH2 multiplexing protocol. There is lots to explore here. There are tests which demonstrate some of these capabilities, as well as updated documentation at http://code.google.com/p/xtreams. Or, more specifically: http://code.google.com/p/xtreams/wiki/Grid The latest version of XtreamsDevelopment as of this writing is 526.

[Xtream FM Venezuela] ESCUCHA EL NUEVO SINGLE DE DEMI LOVATO, ‘COOL FOR THE SUMMER’ … Cool for the Summer es la música inédita que nos llega de Demi Lovato para este verano. La norteamericana se pone cañera para la estación estival y viene con intención de hacernos bailar, algo que todos hacemos mucho a lo largo de estas fechas … http://xtreamfmvzla.blogspot.com/ (en Acarigua-Araure)

Code coverage for Xtreams using StasisField to detect what has and hasn’t been called in the image. StasisField is an experimental code-coverage technique that unloads code from the image and dynamically reloads it back in to the image when a method is called. It requires no changes to the VM and once a method has been resumed, there is no further cost to the code-coverage mechanism, making it one of the most efficient techniques for reducing runtime memory and for measure code-coverage.

instagram

[Xtream FM Venezuela] TERROR EN EL VÍDEO DE ‘CHEYENNE’, DE JASON DERULO … Que falten meses para que llegue Halloween no quiere decir que estemos en un mal momento para aprovechar la estética de las películas de terror para promocionar una canción. En su día, le funcionó a Michael Jackson, a los Back Street Boys y ahora veremos si también a Jason Derulo … http://xtreamfmvzla.blogspot.com/ (en Acarigua-Araure)

instagram

[Xtream FM Venezuela] SIGMA Y ELLA HENDERSON YA TIENEN VÍDEO PARA “GLITTERBALL” … Ella Henderson y Sigma unen fuerzas en Glitterball. Ambos artistas han liderado las listas de ventas de Reino Unido y ahora intentarán conseguirlo juntos.El tema se pondrá a la venta el 31 de julio pero su vídeo acaba de ser estrenado en Youtube vía 3 Beat. Las imágenes nos introducen de lleno al verano y vemos a los productores pasándoselo en grande en un velero mientras Ella posa delante de un proyector … http://xtreamfmvzla.blogspot.com/ #ParaGenteComoTU #XtreamFMvzla #InstaMusic #InstaNews #Radioweb (en Acarigua-Araure)

instagram

[Xtream FM Venezuela] SELENA GOMEZ PÚBLICA EL VÍDEO DE “GOOD FOR YOU” … Selena Gomez ya tiene vídeo para Good for You, su nuevo single. La cantante de 22 años presenta unas sencillas imágenes para la canción que sucede a The Heart Wants What It Wants … http://xtreamfmvzla.blogspot.com/ #ParaGenteComoTU #XtreamFMvzla #InstaMusic #InstaNews #Radioweb (en Acarigua-Araure)

instagram

[Xtream FM Venezuela] STEVE AOKI Y LINKIN PARK YA TIENEN VÍDEO PARA ‘DARKER THAN BLOOD’ … Darker Than Blood es el nuevo single de Steve Aoki que cuenta con la colaboración de Linkin Park. La canción, escrita por el mismo DJ y la banda, se encuentra dentro del álbum Neon Future II y se trata de la segunda vez que se juntan el grupo y el productor, tras A Light That Never Comes … http://xtreamfmvzla.blogspot.com/ (en Acarigua-Araure)

instagram

[Xtream FM Venezuela] AURYN PUBLICA EL VÍDEO DE “I’LL REACH YOU”/ “TE SIGO” (+VIDEO) … Auryn estrenan videoclip para I’ll Reach You/Te Sigo, el tema principal de la banda sonora original de Atrapa La Bandera, el nuevo largometraje de animación que llega de la mano de los creadores de Las aventuras de Tadeo Jones y que verá la luz el 28 de agosto bajo la producción de Telecinco Cinema y la distribución de Paramount Pictures … http://xtreamfmvzla.blogspot.com/ #InstaNews #InstaMusic #ParaGenteComoTu #XtreamFMvzla #FasinantementeBuena #Music #RadioWeb (en Acarigua-Araure)

instagram

[Xtream FM Venezuela] LA FIESTA DE PITBULL Y CHRIS BROWN EN EL VÍDEO DE “FUN” (+VIDEO) … Pitbull apuesta por su colaboración con Chris Brown como nuevo single de Globalization. Fun ha sido desde su lanzamiento uno de los temas más llamativos del disco y ahora ya cuenta con videoclip; Las imágenes nos trasladan a los 80, al estilo Miami Vice, y echan mano de la misma estética que Iggy Azalea en la portada de The New Classic o Havana Brown en el clip de Big Banana. Globalization se puso a la venta el pasado noviembre y de él ya se han extraído éxitos como Wild Wild Love, junto con GRL, o Fireball… http://xtreamfmvzla.blogspot.com/

instagram

[Xtream FM Venezuela] RICKY MARTIN ESTRENA EL VÍDEO DE “LA MORDIDITA”, CON YOTUEL (+VIDEO) … La Mordidita significa una nueva apuesta de Martin por la música en español después de las recientes Disparo en el Corazón o Adiós. Este nuevo tema se incluye en A Quien Quiera Escuchar, álbum lanzado este mismo año a través de Sony Music. La promoción de La Mordidita coincide con la de Mr. Put I Down, single lanzado a nivel internacional y que también cuenta con una colaboración, en este caso podemos escuchar a Pitbull… http://xtreamfmvzla.blogspot.com/ #ParaGenteComoTU #XtreamFMvzla #RadioWeb #InstaNews #InstaMusic