Coding in Assembly

margaret_hamilton
In my work, I often come across a younger generation of engineers who are interested to write software. When asked on tips on how to be a better programmer, I often tell them to study assembly. The result is usually a mixture of shock and incredulity.

Assembly programming is taught as a matter of course, in any electronics engineering program worth it’s salt. It is a very important skill to learn as it is one of the key areas of programming that require a certain level of technical engineering knowledge to understand. Therefore, as engineers, we have no excuse to be afraid of assembly programming.

Most of the time, these people are coding in C/C++ and not one of the sexier languages. I often remind them that C was only invented around 1970 and humans were perfectly capable of writing complex software in assembly, well before that. Today, many people still write assembly code when they’re forced to deal with certain hardware registers or because there isn’t a suitable C/C++ construct to access specialised features of the processor.

It is in this realm that the electronics engineer comes in handy – to work on software that runs close to bare-metal.

Therefore, it saddens me to think that the younger generation of electronics engineers today think that embedded systems programming means using something like the Arduino. While I think that the Arduino is an absolutely useful tool for developing embedded systems, it is not a great tool to teach it to electronics engineers because it abstracts everything away.

In fact, learning to read and write assembly is an absolutely amazing way of improving one’s programming skills in any language. After doing it enough times, one can truly appreciate how all the software constructs are reduced to machine operations. It basically teaches a person to think like a compiler and allows us to truly instruct the machine to do what we want it to do.

It feels like magic.

PS: Look at the amount of code that was written in the past. Think at how much work went into that. Lines of code? Try volumes of code.

TPPA – IP Chapter: Another Look

This article first appeared on DNA.

The Trans-Pacific Partnership Agreement (TPPA) has been getting a lot of attention recently, as the text has been released after years of secret negotiations.

In Malaysia, there is a special sitting of Parliament scheduled to debate the merits of the TPPA.

I had the opportunity to read the TPPA chapter (PDF) on intellectual property (IP) rights recently.

While the chapter itself is merely 74 pages of legalese, in order to make sense of it, I had to read relevant parts of other treaties – for example, the Agreement on Trade-Related Aspects of Intellectual Property Rights (TRIPS), Paris Convention, Berne Convention – and so on, as these are regularly referenced from within the chapter.

Additionally, I read up on the local legislation such as our Copyright Act, Patent Act, etc., to compare the differences between pre-TPPA and post-TPPA scenarios.

Let’s just say that there was a lot of reading involved for a single chapter, and I can appreciate why few have a real grasp of the entire agreement, and also why many are asking for more time to study it instead of rushing into signing in February.

Politicians and civil society have raised issues of biologics and pharmaceutical patents when it comes to the IP chapter.

However, I would like to point out that the IP chapter goes much further than pharmaceuticals and biologics, and I’m afraid that some other issues may have been overlooked.

I have commented on the issue of copyright extensions previously, and I won’t repeat those remarks here.

However, I’m interested in highlighting some other changes that piqued my interest while I was digesting the chapter.

Sounds and scents

Trademarks are undergoing interesting reform. Trademarks are currently protected under the Trademark Act 1976 in Malaysia.

However, our current law merely protects marks such as unique names, signs, and geographic indications.

Under Article 18.18 of the TPPA, each government must not deny a trademark application for merely being a sound and must also make best effort to register scents.

This means that trademarks are being extended to both sounds and smells. As an example, instead of merely protecting the name of Satay Kajang, one may soon be able to protect the unique smell of burnt satay and also the unique sounds made while it roasts.

Textiles

Industrial design is often missed when discussing IP as it is not primary protection. Industrial design is currently protected under the Industrial Design Act 1996 in Malaysia and typically covers designs such as product packaging and furniture, but not textile designs.

A PwC study (PDF) shows that the Malaysian textile sector is set to register the largest gains in export growth due to the trade effects of the TPPA. I’m sure that our local textile industry is happy to hear this.

Reading Article 18.55 of the TPPA together with Article 25.2 of TRIPS, each government must ensure that textile designs are protected under industrial design.

Also, reading it together with Article 26.3 of TRIPS, the period of protection is being extended to 10 years from the current five years.

As a result, while the textile industry in Malaysia is set to grow, it will have to pay licensing fees for the textile designs that are manufactured, even for designs that are way past season.

Online services

Under the Copyright Act 1987 of Malaysia, Internet service providers (ISPs) are burdened with the responsibility of policing copyright infringements. If a rights-holder complains to the ISP of an infringement, the ISP is required to take certain actions as detailed in the law.

Under Article 18.82 of the TPPA, the definition of ISP is being extended to include online services that store content; and provides links to any other online location using hyperlinks.

That pretty much describes every modern online service.

What this means is that any online service that provides user-generated content, which is pretty much any social media-enabled service, will now be responsible for policing copyright infringements. It even covers content that is automatically scraped and aggregated.

Trade secrets

Trade secrets are mentioned only in a single article within the entire chapter. Also, there is no specific Malaysian law that deals with trade secrets.

Therefore, it is easy to understand why this issue has gone under the radar.

Under Article 18.78 of the TPPA, each government must enact specific laws to deal with the unlawful disclosure of trade secrets and must provide for criminal procedures and penalties if such a law is breached.

I do not think that it is right for the government to incarcerate someone to protect the commercial interests of corporations. Unlike state secrets, trade secrets do not endanger the public nor harm the rakyat (citizenry). Think on that for a minute.

These are just some of the interesting ones but there are many other changes and I would recommend anyone with an interest in IP to read the chapter.

As someone who minds his own business, I will have to get myself ready for these changes as many of the provisions must come into force within two to three years after signing.

Personally, I think that the biggest beneficiaries of the IP chapter are the agents and lawyers. They will definitely see more business.

Maybe it’s time for me to start an IP firm.

Total Recall: Scholarship Woes in 1998

Our government has recently refined the national budget due to the slowing economy in Malaysia. One of the victims of the modified budget is the JPA scholarship programme. You will find details about it reported elsewhere.

I’m not going to talk about the rightness or wrongness of reducing the JPA scholarships. What I intend to do is share a story – one that is familiar with the scholars around my age.

The year was 1998.

We were promised scholarships to pursue our studies abroad the year before. Then, the Asian Economic Crisis hit and the government had to tighten its purse strings. One of the victims was the JPA scholarship programme, but it wasn’t the only one.

Those who were already overseas were fortunate as they were allowed to continue their studies abroad. However, there were many who were less fortunate.

Those who had just finished their pre-university studies and had gotten offers from various universities around the world, and those who were partly through their pre-university studies were hit the worse. These two groups were redirected to local universities – mostly UTP, MMU and UniTEN – and made to sign new local scholarship contracts that superceeded the overseas scholarship contracts that they had signed previously.

The worst hit were the ones who were only partly through their pre-universeity studies. Since the highest academic qualification that they had at the time was SPM, they had to reboot their education and start over. Effectively, they lost a year of their time preparing for a pre-university examination that they never took.

At the time when JPA announced its cuts, there were many other scholarship awarding bodies – such as PETRONAS – who did not announce any cuts. In fact, many PETRONAS scholars thought that our scholarships were safe because oil is traded in USD and PETRONAS was not that badly affected by the falling exchange rate.

However, due to government policy, other government related scholarship funds made similar changes. I got caught up by this as we were told that our scholarship program was cancelled. I will always remember the day that I received that letter printed on thick paper with a PETRONAS letterhead in the post box starting with, “dukacita dimaklumkan…”

Those of us who had yet to begin our journeys were redirected to local foundation programs and offered local scholarship contracts instead. We were the lucky ones as we had just finished our SPM and hadn’t yet gotten a foot on the plane yet, unlike our seniors who were kicked off the plane.

Some still managed to appeal the decision and got to go overseas but these were treated on a case-by-case basis and were far and few between and often required a trade-off.

I had a fellow PETRONAS scholar on a Chemical Engineering programme who opted to switch to a MARA scholarship for Accounting as he was insistent on going overseas and he didn’t really care what course he did.

When I was asked to reconsider my engineering course for an accounting one, I barfed at the idea.

I had a room-mate who was one of those JPA scholars who had already completed his pre-university and had received an offer from a university in the UK. He was extremely unhappy with his change of situation and expressed his frustration very visibly.

However, we all got on with our lives eventually.

Orientation week at our local university was like attending an AA meeting. We would begin by introducing our names, then telling each other what course we were supposed to pursue in whichever country we were supposed to be in. This was followed by our current course at the local university.

In a way, I think that this was therapeutic as we were surrounded by hundreds of others who were caught in the same situation and were equally as frustrated and unhappy. This also helped us to bond as a group as we were going through adversity together.

In the end, I think that things turned out for the best as I still had a wonderful time at university.

I think that our lecturers enjoyed teaching us too as we were essentially the crème-de-la-crème of the country who would have normally ended up studying abroad but are now studying locally instead. They certainly gave us a lot of room to work and shine independently.

Looking back at this experience, I think that it taught me the lesson that there are many things beyond our control in life and plans do not always go the way they were inteded. However, it isn’t the end of the world. Life is much more than an overseas education experience.

As they say, “when life gives you lemons, make lemonade.”

In the end, I still managed to work my way to an overseas education for my PhD, at one of the top universities in the world.

So, this story has a happy ending.

 

Half-hearted Broadband Upgrades do more Harm

This article first appeared on DNA.

Recently, I received a phone call from Telekom Malaysia (TM) offering me a free upgrade of my high-speed broadband subscription from the previous 10Mbps package to the brand new 30Mbps package, for the same price.

I must be one of those irrational people mentioned in my previous article, who prefer to subscribe to slower broadband packages, because I rejected the offer of a free upgrade and decided to stick to my present 10Mbps package instead.

Previously, TM used to sell several high-speed broadband packages ranging from 5Mbps to 20Mbps, for both home and business users. Today, it has abolished all these packages in favour of offering only 30Mbps and 50Mbps packages to new subscribers.

According to a study by the Internet Society and TRPC on Unleashing the Potential of the Internet for Asean Economies, published in 2015, the average broadband speeds globally, within Asean, and in Malaysia, are about 20Mbps, 15Mbps and 5.9Mbps respectively.

These new TM packages should significantly bolster our national average to hit the 20Mbps target mentioned in the 2016 national budget, propel us to become the second fastest nation in Asean, and a world-class broadband nation. Bravo!

Unfortunately, the devil is in the details. These new packages come with mere 5Mbps and 10Mbps upload speeds for the 30Mbps and 50Mbps packages respectively. There is currently no package on offer with more than a 10Mbps upload speed.

That is why I rejected the purported upgrade because if I had agreed, while my download speed may have improved from 10Mbps to 30Mbps, my upload speed would have dropped from 10Mbps to 5Mbps.

This has a negative impact on the way that I work and live. I do not understand why TM is packaging it this way.

Historically, before we had high-speed broadband in Malaysia, the broadband service that we had – Streamyx – was deployed over ADSL (asymmetric digital subscriber line). The ‘A’ stands for asymmetric because the upload and download speeds are different – for example, 8Mbps download with 512Kbps upload.

This difference in speeds was due to a technical limitation of ADSL technology. However, even the slowest upload speeds offered were still faster than dial-up speeds at the time.

As a result, consumers readily adopted ADSL and got used to the idea of having different upload and download speeds.

However, the high-speed broadband deployments of TM’s UniFi in landed residential properties use Fibre-to-the-Home (FTTH) while most high-rise buildings use Fibre-to-the-Building/ Curb (FTTB/C) coupled with VDSL2 (very-high-bit-rate digital subscriber line) into each individual residence unit.

These technologies are symmetric in nature.

VDSL2 has a 100Mbps bandwidth and FTTx technologies have multi-Gbps bandwidth. Our neighbours down south can subscribe to symmetric 1Gbps broadband for a mere S$39 (US$28 or RM119) per month.

Therefore, I feel that it is disengenous for TM to set arbitrary asymmetric bandwidth limits when there is neither a technical nor a financial reason why such a difference should exist.

I will humbly suggest that this behaviour of arbitrarily limiting our upload speeds has a negative economic impact.

According to Pemandu, the very first Entry Point Project, EPP1 for the Communications Content and Infrastructure sector aims to, “enhance capacity, capability and competency in Malaysia’s creative industry to produce world-class content and make the country a regional hub for digital content.” It is expected to create 10,000 jobs and increase GNI (gross national income by RM3 billion.

Pemandu is the Performance Management & Delivery Unit of the Prime Minister’s Department, tasked with overseeing the Government’s aspiration of transforming Malaysia into a high-income nation by 2020.

If you’re someone trying to answer the call of the Government to turn Malaysia into a regional hub for digital content, you may be making a mistake if you decide to upgrade to the new packages.

Slow upload speeds definitely affect you if you’re a content creator. If you’re a filmmaker, you will already know that it takes a lot of bandwidth to upload your latest HD (high-definition) videos.

However, high upload speeds do not merely impact filmmakers.

Higher upload speeds allow people to communicate better, by using video-conferencing instead of mere voice calls. It also allows people to work from home as effectively as they work in the office, which would improve family values.

It would also enable broad deployments of telemedicine, which could save countless lives especially in the interiors.

It’s not cool that TM has decided to arbitrarily limit our ability to work and live.

Furthermore, by arbitrarily limiting upload speeds, TM is inadvertently hurting our national aspiration of becoming active content creators and turning us into a nation of passive consumers instead.

TM has even graciously allowed us to consume content five to six times faster than we can produce it.

To be fair, if you’re currently on the 5Mbps package, then you will not have any negative experience from the upgrade other than having to pay more for it.

However, if you’re currently on the 10Mbps package, you’ll experience a downgrade if you decide to upgrade to the 30Mbps package. Instead, you should get the 50Mbps package.

I would have willingly upgraded to 20Mbps upload and download for the price of my current package. That would have been an improvement. It’s unfortunate that such an option is no longer even available.

While I applaud the effort to improve our high-speed broadband to meet international standards, I think that it should be done whole-heartedly.

Preventing Future Volkswagen-like Scandals

This article first appeared on Digital News Asia.

I am sure that most would have heard about the recent software scandal at Volkswagen. It has been widely reported by all international media and many have weighed in with analyses on why it happened.

It has even been likened to Libor on wheels, and this scandal may just change the entire automotive industry.

In the immediate aftermath, the price of VW shares have tanked by 30% and the chief executive officer has resigned. Millions of VW vehicles are being recalled and lawyers are tripping over each other to file class-action lawsuits. Even VW subsidiaries Audi and Skoda have been implicated.

While the immediate repercussions are grave, nobody really knows how far the fallout of this scandal will reach.

Personally, I think that this scandal presents an opportunity for reforming a part of the industry.

The automotive industry has always played a leading role in setting standards for software reliability and safety. Now, it has the chance to lead the way in ethical software standards too.

While there are questions about how such an unethical thing could have gotten past management, with the associated implications such questions bring, what’s shocking to me is how the engineers who have a professional responsibility of ensuring design safety could have written the software to lie about potentially harmful emissions.

A comparison has been made between the VW software engineers with the accountants in the Enron case who collaborated with the organisation to create accounting loopholes, and who failed to protect the public by not providing proper auditing.

Therefore, some feel that the solution is to do a better job of teaching engineering ethics.

With all due respect, I don’t think that teaching ethics is going to solve the problem of gaming the system. It’s clear that this VW scandal is not merely the product of rogue engineers.

I would humbly submit that the only way to prevent this ethical problem is by increasing transparency in the design of automobiles. As far as software is concerned, this can be accomplished by adopting an open-source philosophy for car manufacturers.

With an open-source philosophy, anyone would be able to study and verify that the cars work as advertised. No car manufacturer would allow their engineers to cheat if they would be discovered by a simple examination of the software source code.

In fact, a source code audit should be made part of any compliance process.

In addition, not only does providing open-source software ensure a permanent fix for this ethical problem, it has also been shown to improve overall software quality.

The previous automotive software scandal of Toyota’s killer firmware might have been detected earlier or avoided altogether if the source code had been made available for examination and audit.

With modern cars being very much software driven, it is also going to be a juicy target for hackers, as recent cases with Jeep and BMW have shown.

Hackers can now remotely kill a vehicle while it is moving on the road. While recent hackings were done by researchers, you can be sure that there are those who will do this for nefarious reasons. Our very lives are at stake.

Therefore, it is crucial for vehicle safety that all software must be securely written and audited. This cannot be provided for as long as vehicle manufacturers hide their software behind an opaque wall.

It is a well-established mantra in information security that security by obscurity is not security. While merely opening up the software will not guarantee security, it is at least a step in the right direction.

This open-source philosophy is already so deeply ingrained in the computer software industry that it should not be difficult to implement in the automotive software industry.

All that is required is a mind-set change in the boardroom and this scandal might just provide the necessary impetus to make that change.

One of my big frustrations with driving a car is with the dilapidated state of its software. While the embedded software that runs modern cars seem to be stuck in the 20th century, it doesn’t need to be.

Automotive software has already seen more innovation in the last few years than it has in the previous decade. It is now set to drive the growth of the modern car.

With the automotive industry set for an industry-wide software disruption by the likes of Tesla, Google and Apple, I don’t think that the traditional car manufacturers have a lot to win by protecting their software silos.

Instead, they could choose to lead by adopting a standardised software platform that is open-sourced and is widely available for all automotive use.

Look what such a thing did for the entire smartphone industry and how it changed the lives of billions around the world.

It is time for Volkswagen to issue an industry-wide call for a major collaboration on a standards-compliant and open-source automotive software platform.

Irrational Malaysians Prefer Slow Broadband?

This article first appeared on DigitalNewsAsia.

MALAYSIA’S newly minted Communications and Multimedia Minister, Dr Salleh Said Keruak, courted controversy recently by saying that Malaysian Internet users prefer the slower Streamyx broadband package that offers speeds of between 384Kbps and 1Mbps.

Many – including a former minister – have rubbished this assertion.

With all due respect, I think that our Minister has confused correlation with causation. No Malaysian would prefer to have a slower broadband package, if they had a choice.

The problem with the situation in Malaysia is that most people lack that choice.

The Minister himself points out that, in the end, it all boils down to affordability. This is completely accurate. If we had affordable high-speed broadband, nobody would rationally prefer the slower broadband packages.

In a recent study by the Internet Society and consulting firm TRPC on Unleashing the Potential of the Internet for Asean Economies published in 2015, they identified the Asean countries that do have affordable broadband access, taking into account GDP (gross domestic product) and purchasing power parity: Singapore and Thailand only.

The same study shows that these countries have average broadband speeds that are higher than the Asean average of about 15Mbps.

Malaysia’s average broadband speed of about 5.9Mbps is well below the Asean average. This is just plain embarrassing for the home of the Multimedia Super Corridor (MSC Malaysia).

We are now lagging behind many of our Asean neighbours and this may have a detrimental effect on our already suffering economy.

Another study by Ericsson, Arthur D. Little and Chalmers University in 2011 has quantified the impact of broadband speeds on national GDP. It claims that a simple doubling of broadband speeds increases GDP by 0.3%, while additional doublings can yield even more growth – for example, quadrupling of speeds increases GDP by 0.6%.

Read the other way, this means that by preferring to have slower broadband speeds, Malaysians are also choosing to reduce our GDP by a significant amount.

To put things into perspective, according to the World Bank, Malaysia’s GDP was US$326.9 billion in 2014. So ‘halving’ our bandwidth decreases our GDP by more than RM4.34 billion (US$980 million) a year.

Now, chew on that number for a bit and consider why our Government is not too concerned with increasing our broadband speeds.

Sure, some may argue that we do not need to have super-duper high-speed broadband in this country. Some even suggested that the demand for high speeds in Malaysia is purely driven by file-sharing piracy.

But the fact of the matter is that higher bandwidth means more modern services can be supplied to every home.

The same study by Ericsson claims that growth stems from a combination of direct, indirect, and induced effects. The induced effect, which includes the creation of new services and businesses, is the most sustainable dimension and could represent as much as one-third of GDP growth.

Everyone already knows that the future of computing lies in the ephemeral ‘cloud.’ This means that we will need high bandwidth for everything, since all our data and our everyday lives are going to be stored and processed on the Internet.

There is no escaping this new paradigm of computing as those who have no knowledge of a world without the Internet embrace this.

Personally, I don’t like to speculate on what people are going to do with their high-speed broadband when it arrives in their homes. I believe that Malaysians are a creative and entrepreneurial bunch. Once there is abundant bandwidth, I can guarantee you that someone will find a way to profit by using it for something other than piracy or porn.

Of course, broadband speeds are not the magic doorway to a high-income economy, but it sure is a step in the right direction.

Furthermore, a recent report from the Human Rights Council of the United Nations has declared that access to the Internet is a basic human right. The same report states that Internet access facilitates economic development and enables individuals to enjoy a range of basic human rights, such as freedom of opinion or speech.

In fact, in some parts of the world, broadband rights are already codified into local law. While none of our Asean neighbours have adopted such lofty ideals, we can all immediately appreciate how faster Internet access provides more opportunities for people to better their lives.

Even the most authoritarian governments understand this.

In the case of broadband speeds, more is definitely better. Higher speeds allow people to communicate better, by using video-conferencing instead of mere voice calls. It also allows people to work from home as effectively as they work in the office, which would improve family values.

And it would also enable broad deployments of tele-medicine, which could save countless lives, especially in the interior and remote areas.

To suggest that Malaysians would actually prefer to subscribe to slower broadband speeds is plain irrational and I refuse to believe that Malaysians are irrational people.