The dining philosophers problem
Five philosophers sitting at a circular table do one of the two things: eating or thinking. While eating, they are not thinking, and while thinking, they are not eating. A large bowl of rice is placed at the center of the table. One chopstick is placed in between each pair of adjacent philosophers and as such, each philosopher has one chopstick to his left and another to his right. To eat, one must have a pair of chopsticks, but because there are only five chopsticks on the table, thus at most two philosophers can eat at one time.
If every philosopher takes the chopstick to his left, then no one will be able to eat throughout the dinner session. How to ensure everyone of them will have the chance to eat, if they do not talk to each other, and hence negotiation is not possible?
In retrospect to the problem statement above and to make the situation more interesting or worse:
Each philosopher thinks for t seconds and eats for n seconds. At every x seconds after eating, the philosopher begins to starve. When he is starving, he begins to grump and no longer thinks. At z seconds, the starving philosopher will die if he still does not eat. This creates competition for resources (chopsticks in this case) and prioritizes starving philosophers.
Can Chandy-Misra solution solve this problem?
Transverse Myelitis
Just came back from the hospital after visiting my uncle. He has been admitted to hospital last evening. He was admitted to the General Hospital last Thursday and was discharged this Sunday. No conclusion from the GH.
His doctor came in when I was there. He said my uncle suffers from acute Transverse Myelitis.
Transverse Myelitis (TM) is a neurological syndrome caused by the inflammation of spinal cord. It is a complicated disease and takes times to eradicate inflammation. His doctor has done lumbar MRI today. They will do another thoracic MRI tomorrow to confirm clinical diagnosis.
Flash of the titans
Apple’s decision for not to implement Adobe’s Flash into iPhone OS has turned Adobe-Apple relationship sour. In an open letter from Steve Job, he has written clearly about Flash’s weaknesses and a firm stance against Adobe’s Flash. I absolutely agree with Steve based on my experience with Flash. I would say: “Flash is nice to look at, but is a nightmare to have it!”
A week or two before Apple published Job’s open letter, I learned about an open source Flash project called Gnash from Twit. You can listen to the podcast here.
I really don’t believe in develop-once-deploy-everywhere development concept. I am more a native application guy because I only believe in native performance without relying on third party software components to run the applications. My experience with Tweedeck served as a wonderful example.
Tweetdeck was developed using Adobe’s AIR and Flash technology and is a develop-once-deploy-everywhere kind of application. Its user interface on the Mac really sucks. It looks more like a Windows application rather than Mac’s native Cocoa application. One thing annoyed me was that I had to upgrade Adobe’s AIR whenever it became available. I feel happier for not running Tweetdeck now.
A Java application has its downsides as well. It too depends on Sun’s JVM (Java Virtual Machine). Java has never become an implementation language in my software development career. Only recently when I began to involve in web application development, I have to work with JavaScript. The experience is awful, in my experience.
It is understood why Adobe is so furious about Apple’s decision not to allow Flash on its mobile platform. The reason is obvious: Adobe loses its grip on Apple’s mobile devices and has been discounted in Apple’s mobile computing gameplay. But Apple is not an easy-to-squeeze apple, it is huge and capable.
Apple has been working on an open web standard HTML5 and Apple’s own version of Flash, Gianduia. With HTML5, Apple’s computing platform becomes even more open, unlike otherwise as Adobe claimed. Both are exciting new technologies which I would like to implement to the web application I am developing.
I will write more about HTML5 and Gianduia when I have found time to research more about these two.
Timeless memories
I used to have the desire which my ashes will be carried away by ocean waves and winds. This morning, I came across this website, Glass Remembrance, where a person’s ashes can be made into beautiful hand-made glass art.
I like to be preserved this way after my death. My children can have a portion of “me” in a nice decorative glass flower in their home, if they want to.
Nuclear power plant for Malaysia?
Two days ago, the Malaysian government announced that the country is considering to have nuclear power plant by 2021. This was certainly a good news, but after a while of mind mingling, I think the implementation could be a disaster!
The nuclear energy is the greenest energy currently available on Earth. James Lovelock, a scientist, environmentalist, futurologist and the father of Gaia Hypothesis wrote in his book: “The Vanishing Face of Gaia: A Final Warning”, that the nuclear energy is indeed greener than any other form of power generating plants including solar voltaic and wind energy farm. A 1GW wind farm requires 2 millions tons of concrete, enough to build 30,000 homes for 100,000 people. That quantity of concrete would release 1 million tons of carbon dioxide into the air.
The under-construction Bakun Dam, located in Sarawak on the Balui River, will be the tallest concrete-faced rockfill dam in the world and the largest dam in Asia outside of China. Its powerhouse with 8 penstocks to powertrains comprising 8 vertical shaft Francis turbines of 300MW each, 8 air-cooled generators of 360MVA each and 8 oil-immersed transformers (360MVA each) will generate about 2.4GW of electricity. The dam has 16.71 million cubic meters of filled volume. With catchment area of 14,750 km square, its gross storage capacity is 43,800 million cubic meters. How much concrete is required to build this dam? How much carbon dioxide will be released by the concrete? How much biodiversity would have perished under catchment area that large?
I read from various sources about people’s objections (including politicians’) of this nuclear energy project. This should not be a political issue and never be one. This should be an environmental, safety and social-economic issues at top.
TNB, the sole electricity distributor/supplier in Malaysia is not the sole energy producer. TNB buys, under contract, energy from many other producers. Unfair advantages, unscrupulous practice and increasing fuel cost in the produce-supply chain have contributed to rising energy cost, leading Malaysians to cry foul. The substandard service provided by TNB worsens the situation. As a corporation with revenue of MYR25.75 billion and net income of MYR2.6 billion as of fiscal year 2008, TNB is cutting more corners to reduce its operating costs and to maximize its profit with unhealthy practices, e.g. bi-monthly meter reading practice has stirred uproars in recent week. Being greenest, nuclear energy is more profitable than any other energy production. Could this help to reduce electricity cost for Malaysians considering the unhealthy practices and unfair advantages TNB has in its glossary bag?
I am not going to write more about TNB’s malpractice and sluggish substandard service. Ask any Malaysians, they will be able to tell you stories whole day and night. Instead, I am going to write more about safety.
The next question: Is it really safe to have nuclear power plant in Malaysia? This question does not imply that nuclear power plant is not safe. Rather, the human factors in managing and operating the nuclear power plant.
Alongside the nuclear physics in the power plant is the safety critical computer system, which includes both hardware and software, that is used to control and monitor the nuclear power plant. This safety critical system is the most crucial part and the entire operation of a nuclear power plant heavily relies on it.
Safety critical system is a computer (including software), electronic or electromechanical system whose failure may be a catastrophe, causing injury or death to human beings. This safety critical system comprises high integrity software. The safety critical system, both hardware and software, will likely be integrated and maintained by foreign contractors.
Nuclear power plant software are developed using Ada and/or SPARK programming language. SPARK is a subset of Ada. In the mid 1990s, UTM (University Technology Malaysia) KL campus was teaching Ada in CASE (Center for Advanced Software Engineering). At that time, CASE was a collaboration between UTM and Thomson CSF under special arrangement between the government of France and Malaysia. The Ada course was not long lived. Two years later, it was replaced by Java due to ignorance and market driven trends. Java is not a suitable candidate for high integrity, safety critical, real-time and distributed application development. Today, none of the universities in Malaysia is teaching Ada. According to my hitherto knowledge, apparently none of the Malaysia academies have submitted any high integrity and safety critical system related papers in international conferences and scientific journals.
It does not only require software engineers with Ada or SPARK knowledge. In safety critical software engineering, the individual developers, the entire team and organization are required to go through rigorous software development and safety critical validation processes. It takes years to achieve Carnegie-Mellon’s SEI (Software Engineering Institute) CMM (Capability Maturity Model) Level 5. Safety critical system development requires utterly strong discipline and engineering ethics in every requirement, design, development, testing and maintenance process and every process needs to be validated. Other than software process, there are many other non-software related risk assessments to comply.
Malaysia lacks qualified software engineers of such competency to develop and to maintain high integrity software system. It is costly to maintain such system by contract. The maintenance will increase the cost of energy production and hence will be borne by consumers.
The safety critical system of a nuclear power plant must be thoroughly tested with proven track records. With the loosey-goosey attitude of many Malaysians, will they have capability to manage the system and safety critical issues? Will they be effective to respond to emergencies, for example, system shutdown or nuclear melt down?
The disposal of nuclear waste poses another safety issue. If the engine of a RMAF (Royal Malaysia Air Force) fighter jet could go missing and be exported, can you imagine the potential hazard of missing nuclear waste?
Objection should be rational, not emotional. It is imbecilic to politicize the objection without scrutinizing facts. I, in my book, embrace nuclear energy for it is the greenest energy. On the contrary, I do not have any confidence in the management of safety related issues in Malaysia.


Listen to my podcast