Home Blog Page 590

Tune Up Your Code with the Crankshaft Compiler

Safia Abdalla is an open source developer and a maintainer on a project called nteract, but her pet topic is compilers. And, in her talk at Node.js Interactive, Abdalla explained the inner workings of the V8 compiler and how it can optimize the code it gets fed. Although Abdalla specifically focused on what goes on in the V8 compiler, she noted that there are many similarities to other compilers.

Crankshaft (vs. Full Codegen)

Crankshaft is the optimizing compiler in the JavaScript V8 engine (which is used by Node). When you run code in Node, it passes through the Crankshaft compiler — unless you tell it not to with:

node --crankshaft=false

Most readers will be familiar with the concept of compiler — that is, a program that converts source code into executable bytecode. However, there is a subset of compilers, called Optimizing Compilers that have a more specific role. Crankshaft is an optimizing compiler.

An optimizing compiler, explains Abdalla, is “one that more intelligently looks at the code it’s translating to try and improve some aspects of the code.” It does this by replacing poorly performant operations with performant ones. This often entails trying to reduce execution time by reducing the number of instructions the machine needs to run.

V8 also contains a non-optimizing compiler, called Full Codegen. All the code passes through Codegen and is compiled (and this is important as Abdalla shows later), but only code that is susceptible of being optimized gets passed onto Crankshaft.

The Full Codegen compiler is faster compiling than Crankshaft, because it does not have to search for ways of optimizing any code. However, the code it produces is generally slower. It also produces machine language code directly from what is called the abstract syntax tree (AST), while the Crankshaft compiler takes several intermediate steps between AST and machine language.

How does Crankshaft work?

The first step is to parse the code. “Parsing” in this context, says Abdalla, is the process of converting the source code into an AST. Both the Full Codegen and Crankshaft execute this parsing. The parsed code is never stored in memory. Every time the compiler needs the AST for a certain chunk of code, it needs to call the parser again to get it.

The keywords and phrases of your code are parsed into a parse tree, which is then converted into an AST — a tree-data structure in which the roots and parent nodes are operators, and the children nodes are operands.

Once you have the AST, the compiler builds the Hydrogen representation, a higher level intermediary data structure. The hydrogen representation needs some information about the variable definition in the program, things like their type and scope, to be able to perform some optimizations.

As it’s building the representation, Crankshaft already starts to incorporate some optimizations into the code. Although there are many possible strategies to optimize code, Abdalla focuses on function inlining — the killing off dead code and common subexpression elimination. Function inlining consists of substituting the call to a function for the code the function would have executed. This is done because calling functions takes up a lot of operations at the stack level. As optimizing is all about reducing the number of operations executed, function inlining often makes a lot of sense. However, as Abdalla points out, this cannot be done in all cases. Using function inlining for recursive functions, for example, would be an especially bad idea.

The killing off dead of code happens after the Hydrogen representation has been constructed, and it is used to eliminate code that in the representation has no effect. These fragments of code can be introduced during the construction of the Hydrogen representation or could have been in the original code.

Related to the above, another optimization is the common subexpression elimination (or CSE). This process substitutes expressions within the Hydrogen representation with similar expressions which were encountered previously by the compiler. Basically, it is a way of de-duplicating code.

Once the Hydrogen representation has been optimized, it is translated into a Lithium representation. The code expressions in the Lithium representation are platform dependent, that is, the instructions are dependent on the processor of the underlying machine running the code.

The low level representation is finally translated into native code that the machine can run. Often, code in the Lithium representation can be directly translated to machine code.

But that’s not all…

Abdalla points out that, after attempting all the optimizations, Crankshaft’s job is not always done. Sometimes code will require de-optimizing. As Abdalla explains, Crankshaft “makes some optimistic assumptions about the types of data it will get in certain code blocks and it optimizes specifically for those types.” However, sometimes those assumptions may be invalidated when the code is actually run, and Crankshaft may have to backpedal and use the unoptimized version of the code generated by the Full Codegen compiler.

You can watch the complete presentation below:

https://www.youtube.com/watch?v=lqJIUSygnbE?list=PLfMzBWSH11xYaaHMalNKqcEurBH8LstB8

If you’re interested in speaking at or attending Node.js Interactive North America 2017 – happening October 4-6 in Vancouver, Canada – please subscribe to the Node.js community newsletter to keep abreast of dates and deadlines.

Secure Bittium Android Phone Has Split Personality

As everyone who watches TV and movie thrillers knows, the best way to ensure smartphone security is to tear your phone apart after making an important call and then break it into pieces and toss them into various trashcans and sewer grates. This can get expensive, however, especially if you want a nice model with 4K video and high-end cameras. Hence, the growing market for Android-based ultra-secure phones such as Silent Circle’s Blackphone 2, TRI’s Turing Phone, Sonim’s XP7 Public Safety, and Motorola Solutions LEX L10.

A year ago, Finnish company Bittium — formerly Elektrobit Wireless Communications — unveiled its ruggedized, Android-based Bittium Tough Mobile LTE smartphone as part of its Bittium Specialized Device Platform. At this week’s Mobile World Congress in Barcelona, Bittium followed up with a new software build for the phone based on Android 6.0 that offers a secure, containerized dual-boot scheme to separate user space into Confidential and Public sectors.

The Public mode enables typical usage, including social networking access, while the Confidential mode is “completely isolated and hardened for secure authority and information security use,” says Bittium. As a result, Jason Bourne, Carrie Mathison, and other government, enterprise, and public safety workers dealing with sensitive information, can avoid buying and carrying two separate devices.

Bittium also upgraded the phone’s Bittium Secure Suite, which enables features such as remote management and encrypted connections. The software includes secure boot, runtime integrity, and an application permission firewall. You can encrypt emails with PGP, and call upon FIPS 140-2 compliant hardware crypto. Other features include secure user credential storage, mass memory encryption and tampering detection.

The latest Bittium Secure Suite version adds a feature called Bittium SafeMove Analytics, which strengthens Bittium Tough Mobile’s hand in the first responder and public safety market. Bittium, Sonim, and Motorola all compete in this area, focusing primarily on users of the emerging, U.S.-based FirstNet public safety network.

Bittium SafeMove Analytics adds visual and real-time tracking, as well as sensor-based data collection. Administrators can track users’ movements on a map and create geo-fencing alarms, for example, warning a first responder if they’re moving into a hazardous area. The feature also helps analyze mobile networks and organize a mobile IoT network with on-the-fly analysis of sensor data.

Also at MWC, Bittium demonstrated two medical products. There’s a Bittium Wearable Platform for Health Monitoring that measures stress, fatigue, and sleeping quality, as well as Faros ECG Event and Faros ECG Mobile software for remote heart monitoring.

The Bittium Tough Mobile hardware appears to be unchanged. It runs Android 6.0, up from Android 5.1, on Qualcomm’s quad-core, 2.3GHz Snapdragon 801. The phone is equipped with 2GB LPDDR3, 16GB eMMC, and a microSD slot. The glove-usable 5-inch HD touchscreen is joined by 8- and 2-megapixel cameras.

The 180-gram, 13.5mm thick phone has dual SIM slots, and supports 4G LTE and other cellular standards, including LTE band 14 for public safety. There’s also WiFi-ac, Bluetooth 4.0, NFC, a push-to-talk (PTT) button, and aGPS/Glonass, iZAT positioning.

The Bittium Tough Mobile supplies a full slate of non-healthcare sensors, as well as a USB 3.0 port, speakers, a noise-cancelling mic, a 3.5mm audio jack, and a 2420mAh Li-Ion battery. The cast magnesium unibody design features MIL-STD-810G shock resistance, IP67 water and dust protection, and -20 to 55ºC operation.
 

Solving HPC Conflicts with Containers

Countless stories, comics, and television shows have driven home two very unpleasant stereotypes: the angry, unhelpful system administrator who can’t wait to say “no!” to a user request, and the clueless, clumsy user always a keystroke away from taking down the entire infrastructure. There is a kernel of truth to them. While both resource providers and resource users may want the same end result — the successful completion of computational tasks — they have conflicting priorities when it comes to achieving it.

System operators are tasked with keeping the resource available and performing for all users. This includes ensuring and enforcing proper resource allocation. It also means that any changes to the system have to be thoroughly vetted to ensure that they do not negatively impact the availability and performance of the resource. 

Read more at The Next Platform

NASA Has Just Released Tons Of Free And Open Source Software, Here’s How To Get Them

As a part of its Technology Transfer program, NASA has released lots of free and open source software tools on its website. NASA says that these software are useful for professionals, entrepreneurs, small businesses, industry, and academia. You can visit NASA’s website to get the complete list of available tools and download the ones you desire.

Marking the third release in the series, NASA has officially rolled out its 2017-2018 software catalog

Read more at FOSSBytes

SDN, Blockchain and Beyond: The Spaces Where Open Source Is Thriving Today

What are the newest frontiers that open source software is conquering? Black Duck’s latest open source “Rookies of the Year” report, which highlights areas like blockchain and SDN, provides some interesting insights.

The report, which Black Duck published Monday, highlights what the company calls “the top new open source projects initiated in 2016.” It’s the ninth annual report of this type that Black Duck has issued.

Read more at The VAR Guy

Kubernetes and the Microservices Hierarchy of Needs

Devised by psychologist Albert Maslow, the Hierarchy of Needs is a psychological theory to explain human motivation, comprising of multitier model of human needs, often depicted as hierarchical levels within a pyramid. 

This approach of describing needs is so fundamental that it has been applied to many other domains such as employee engagementcloud computingsoftware developmentDevOps, etc. So it would make sense to apply it to microservices too, as there is a clear list of needs that has to be satisfied in order to be successful in the microservices journey. So here it is:

Read more at The New Stack

10 Things to Avoid in Docker Containers

So you finally surrendered to containers and discovered that they solve a lot of problems and have a lot of advantages:

  1. First: Containers are immutable – The OS, library versions, configurations, folders, and application are all wrapped inside the container. You guarantee that the same image that was tested in QA will reach the production environment with the same behaviour.
  2. Second: Containers are lightweight – The memory footprint of a container is small. Instead of hundreds or thousands of MBs, the container will only allocate the memory for the main process.
  3. Third: Containers are fast – You can start a container as fast as a typical linux process takes to start. Instead of minutes, you can start a new container in few seconds.

However…

Read more at Red Hat Blog

Master JavaScript Programming with 18 Open Source Books

This is the fifth in OSSBlog’s series of open source programming books. This compilation focuses on the JavaScript language with 18 solid recommendations. There are books here for beginner, intermediate, and advanced programmers alike. All of the texts are released under an open source license.

JavaScript is possibly one of the easiest language to get up and running with. But to truly master the language requires a firm foundation of its intricacies. This compilation of books ticks all the boxes.

Read more at: https://www.ossblog.org/master-javascript-programming-with-open-source-books/

What’s The Fastest Linux Web Browser?

Firefox is easily the most popular Linux web browser. In the recent LinuxQuestions survey, Firefox took first place with 51.7 percent of the vote. Chrome came in second with a mere 15.67 percent. The other browsers all had, at most, scores in single percentages. But is Firefox really the fastest browser? I put them them to the test, and here’s what I found.

To put Linux’s web browsers to the test, I put them through their paces on Ubuntu 16.04, the current long-term support of the popular Linux desktop distribution. This ran on my older Asus CM6730 desktop PC. This has a third-generation 3.4GHz Intel Core i7-3770 processor, an NVIDIA GeForce GT 620 graphics card, 8GB of RAM, and a 1TB hard drive. This four-year-old PC has horsepower, but it’s no powerhouse.

Read more at ZDNet

Free Webinar on How To Develop a Winning Speaking Submission from Deb Nicholson and Women in Open Source

Women in Open Source will kick off a webinar series that will discuss cultivating more diverse viewpoints and voices in open source, including both inspirational ideas and practical tips the community can immediately put into action. The first webinar, “From Abstract to Presentation: How To Develop a Winning Speaking Submission” will be held Thursday, March 9, 2017, at 8 a.m. Pacific Time.

Register today for this free webinar, brought to you by Women in Open Source.

In this webinar, Deb Nicholson, FOSS policy and community advocate, will discuss how to write a winning abstract for a CFP to become a speaker. From picking interesting topics and writing a compelling proposal to the best style and format and how to get the biggest audience once chosen, Deb will summarize the most important factors to consider. And she’ll spend time answering your questions. So mark your calendars and join us!

Deb is community outreach director for the Open Invention Network, the largest patent non-aggression community in history and supports freedom of action in Linux as a key element of open source software. She’s won the O’Reilly Open Source Award, one of the most recognized awards in the FLOSS world, for her work on GNU MediaGoblin and OpenHatch.

For news on future Women in Open Source events and initiatives, join the Women in Open Source email list and Slack channel. Please send a request to join via email to sconway@linuxfoundation.org.