Wednesday, January 4, 2023

To C or not to C, That is the Question

As most would know, the Kernighan and Ritchie C Programming Language is an improved version of B, which is a simplified version of BCPL, which is derived from ALGOL, which is the Ur computer language that started the whole madness, when Adam needed an operating system for his Abacus, to count Eve's apples in the garden of Eden in Iraq.  The result is that C is my favourite, most hated computer language, which I use for everything.

At university, I learned FORTRAN with punch cards on a Sperry-Univac, in order to run SPICE, to simulate an operational amplifier.  Computers rapidly lost their glamour after that era!

Nobody taught me C.  I bought the book and figured it out myself.

Over time, I wrote a couple of assemblers, a linker-locator, various low level debuggers and schedulers and I even fixed a bug in a C compiler - not because I wanted to, but because I had to, to get the job done!  

Much of my software work was down in the weeds with DSP and radio modems (Synchronization, Compression, Encryption, Error Correction...) - which, nobody taught me, I had to figure it out myself.  Those were indeed primitive times.

This article is however about the other C - CancerAbout 30% of people get some kind of cancer. It is distressingly common.

Similar to learning C, Cancer is a journey of discovery, it is not something engineers would study at university - maybe we should though, since there is a huge market for diagnostic and treatment machinery.

High School Biology Revisited

As you should recall from your high school biology, almost every cell in a mammalian body has one or more mitochondria. Muscle and brain cells can have several. These organelles resemble bacteria, since they have a cell membrane.  The purpose of the mitochondria is to manufacture special molecules that are needed by a cell.  The most common product is ATP (Adenosine Triphosphate).  ATP is the main source of fuel for a cell, since it can be readily oxidized to produce heat.

Cancer is primarily a mitochondrial disease.  The mitochondria in a group of cells sometimes go haywire and start to produce the wrong chemicals and too little ATP.  The unwanted chemicals are a strain on the liver and kidneys, which must get rid of it and the lack of ATP can make one feel super tired very quickly.  A cancer patient should drink lots of water, to help the liver and kidneys.

The mitochondria normally also produce chemicals that trigger cell death - apoptosis.  If they stop producing that, the cells do not die when they should and the result could be growth of a hard tumour of faulty cells,  which consume nutrients and produce poisons.  A tiny tumour a few mm in diameter is enough of a producer-consumer problem to make one feel really dreadful.

Diseased mitochondria can mean that while walking on level ground may be OK, climbing a single flight of stairs can feel like climbing a mountain, making one reach for the banister and leaving one wobbly and out of breath at the top.

One may be able to do something for an hour, but then have to lie down for ten minutes to recover.  If this is you - better go see a doctor and keep going till you find one that actually listens to you.

Snake Oil and Blood Letting

Engineers have no issue with telling a client: I don't know, but I will find out and get back to you next week.

Some Doctors however, since the use of snake oil and blood letting in time immemorial, will never admit that they don't know.  Some will spin a feel good story, give an Aspirin and tell one to come back in 10 days.  The better doctors, will do blood tests.

When I hurt my back while working around the house and eventually went to a doctor,  complaining about a stiff back and terribly tired legs, he checked and said that my spine is OK, the muscles can be sorted with a massage session, but my tired legs require a battery of blood tests and when he looked at the blood tests, he referred me to a different doctor.

The second doctor went: "Hmm, I can see why you were sent to me" and immediately ordered a full body MRI scan.

Magnetic Resonance Imaging

I happened to work at Elbit in Israel on a military project, when they developed the first MRI machine.  Everyone in the company were absolutely astonished when the first pictures started to appear.  The anatomical detail was just mind blowing compared to the familiar fuzzy X-ray pictures.

An X-ray camera or CT Scanner can visualize soft and hard tissues.  A MRI Scanner though, is the closest thing to a mythical Star Trek Tricorder, since it can visualize the difference between healthy and diseased tissue.

Full body scanners are always located in the basement of a hospital building, since they are incredibly heavy.  The shielding provided by the surrounding earth also helps to get a good SNR (signal to noise ratio) which improves the picture quality.

When you visit a full body scanner, comfortable clothing is advised - athletic tracksuit pants and a T-shirt are good - you have to lie motionless in the machine for about 20 minutes.  Bring a sports bag to keep your documents and all your metal trinkets and metal zippered jackets that you got to take off.  A MRI machine is quite noisy, but for once in a lifetime, it is OK.

When the doctor got the MRI results, he double checked the identified problem area with a small sonar scanner (it is also astonishing how small and effective these hand held devices have become), mentioned that there is a small tumour which started maybe three years ago and which should be curable, then referred me to an oncologist.


When I was at university, I gave a hand (literally - with a steel file!) with the manufacture of huge magnets for a powerful 100 GeV four sector cyclotron.  It was envisaged for use for cancer treatment.  The machine was completed, but never much used, since it was overtaken by cyclotrons with superconducting magnets, which were smaller and cheaper to operate by a factor of hundred!

The old cyclotron was a beast, and was my first involvement with a working, but effectively failed project.  The sad life story of many an engineer!

Modern 10 GeV cyclotrons made by IBA in Belgium, are used to produce radio active isotopes such as Iodine 124 or 18 FDG, which previously required a nuclear reactor to produce. These isotopes are used in PET (Positron Emission Tomography) Scanners, which are used to look for cancerous tissue and heart problems.

The cyclotron which I worked on still exists, simply because the machine is big, heavy and radioactive hot, so there is no economical way to recycle it.  These older type machines are so inefficient that a hospital really cannot afford the huge amount of electricity needed to run them.  Overtaken by new developments, they got entombed in locked and disused hospital basements forever.   

Maybe in a few thousand years, archeologists will dig some old cyclotrons up and wonder what the religious significance of these strange multi-sector objects were and ponder their alignment with the stars. Hopefully they won't die from a mysterious disease soon after examining the machines.

PET Scanners

Whereas a MRI Scanner is perfectly safe, using only extremely high power magnets to excite your tissue, a Positron Emission Tomography (PET) Scanner is decidedly unsafe and should only be used by patients who already have a serious heart problem or cancer (After all, what are the odds of getting another cancer?).

A PET scanner needs to be close to a cyclotron - usually in an adjacent building - so staff can quickly walk across the road with a lead lined container with the required tracer isotopes, before it decays away to nothing.  

Getting to a PET scanner may require a bit of a walk, from the parking lot, up a hill to a basement scanner, since the equipment is best dug into a mountain side for safety and shielding and most lay people would not want to get too close to it, out of an abundance of caution, so you may need to pass though multiple lackadaisical security gates to reach the facility.

From the outside, a PET scanner doesn't look much different from any other kind of full-body scanner - a big and expensive doughnut, with a movable bed.  It is a positron sensor system that measures the concentration of radio-active tracer in your organs.  Areas with very high blood flow will show up hot and an experienced radiologist knows what should be glowing hot and what should not be.

Different types of cancerous tumours, brain and heart problems are best seen with different tracers.  Brain scans use radio-active Glucose and most other things use Iodine.  Therefore, patients are grouped in batches, so that the cyclotron can manufacture the required isotopes.  Therefore you will find yourself with an amazing crowd of people with similar problems.  Over the next few years, you will meet the same bunch of crocked up old fogies multiple times, so you can just as well introduce yourself!

Glowing In The Dark

A PET scan requires some preparation.  A nurse will put you in a cubicle and make you drink a litre of drilling fluid (Barium Sulphate) - it really tastes like drilling fluid too - and after a while you will get a drip with the Iodine or Glucose tracer.  The drilling fluid absorbs background radiation and improves the picture contrast.  After leaving the tracer to circulate for about 40 minutes, you will get the scan, which takes about 20 minutes.

Just for fun, you could build a Geiger Counter ( to check the radiation levels around you.  These devices have been causing engineers and scientists to wonder about life, the universe and everything, for more than a century.

The MightyOhm Beta and Gamma ray detector is easy to build and works a treat - Click, click, clicketyclick - Uhm, maybe I should get ECC memory for all my computers...

Iodine 124 has a half life of about 4 days, so for the next week, you will be glowing in the dark (unfortunately not really - could have been fun!) and you should avoid pregnant women and children, out of an abundance of caution.  FluoroDeoxyGlucose (18 FDG), has a half life of about 2 hours, so you will be fine when you get home already.

The Bumpy Road to Recovery

Getting diagnosed correctly is half the problem.

Once you are an oncology patient, general practitioner doctors may not really want to see you anymore and will tell you to first get the cancer fixed, then you can come back for whatever still ails you.  Even a dentist may be very hesitant to treat you and may at most offer to fill an obvious cavity.  If you break a dental crown, the dentist may try to fix it with plastic and will try his best not to replace the crown.  Even a Thermal Spa or Massage is off limits to oncology patients.

There are various reasons for your newfound Persona Non-Grata Status.  The metabolism of an oncology patient is different from ordinary mortals.  There is a concern that the increased blood and lymph circulation caused by thermal waters and massage, can cause cancer to spread (Though this is not proven).  Due to a diminished immune system, you can however get sick more easily and should avoid crowds and other sick patients, while minor infections that used to heal in a few days, may now take weeks or months to cure with repeated doses of antibiotics.  So there is some method in the madness and whatever you do, don't get sick - you are already sick enough!

Treatments and Cures

Many people (about 97%) get cured of cancer and go into complete remission.  Others are treated periodically for decades, which is just as good.  It is the luck of the draw how it will progress.

Treatment of cancer takes many forms and can continue for months or years.  Hormone therapy is used to change your metabolism and slow the cancer growth down. Chemo Therapy is a treatment with special poisons to kill certain types of cells.  Internal radiation therapy (Brachytherapy) is used with certain hard tumours and involves implantation of tiny pellets of radioisotopes to damage the tumour from the inside. External radio therapy could be done with beams of photons (X-rays), or protons, to damage the tumour from the outside.  Immunotherapy can be used to assist your immune system to clear damaged cells.  It all depends on your particular problem and the available treatment facilities, since new potions and tools are invented all the time.

I got a series of 20 X-ray treatments to burn the little tumour, using a combination MRI and Linear Accelerator machine.  The MRI rotates around to make a 3D image used to position you exactly right, to the mm, on a 6 DOF gantry and then the LINAC rotates around to zap the tumour.  It is not painful, but not exactly something I would recommend for a leisure activity.  After 10 sessions, I could convince myself that I may be starting to feel better and by the 15th session I was sure of it.  However, radiation is a blunt weapon and you end up with damage from both the tumour and the radiation, so recovery will take a while.

You may need to remain close to your assigned oncology centre and your life may need to be arranged around your repeated scans and treatments for the next few years - you got to adapt and get used to your new reality!


A LINAC is a magnetron powered tube, that accelerates electrons over a distance of about 50 cm and slam them into a heavy metal target, which releases X-rays, with an energy of about 20 to 25 MeV, which is then focused into a beam with a collimator.   Some LINACs are configurable to enable the use of the electron beam to treat skin tumours and the X-ray beam to treat internal tumours.

Just to put it into perspective.  If you consider a full chest X-ray as the worst thing ordinary people will get, then 20 radiation treatments with a Magnetron powered LINAC, is equivalent to about 2000 to 3000 full chest X-rays, focused onto a small spot!

Cancer Myths and Cures

There are a few cancer myths doing the rounds.  Here are some for your amusement.

The Italian Dr Simoncini, proposed that some cancer is caused by a fungus and tried to use baking soda to treat it.  It did not work, but it could possibly be beneficial to people who have a fungal infection and cancer at the same time though.

The Mayo Clinic studied the use of high dose Vitamin C to treat cancer.  It doesn't work, but it is beneficial to people who do not absorb vitamin C properly and have (sub-clinical) scurvy and cancer at the same time.  Vitamin C will make them feel a lot better within a few days, by curing the scurvy, but they will still have cancer.

The Human Papilloma Virus (HPV) has been proven to cause Cervical, Mouth and Throat Cancer.  There is now a vaccine against HPV, so there is at least one type of cancer which has a cure (prevention actually).   This indicates that some other cancers may also be caused by viruses and eventually there may be a series of anti-cancer vaccines.

So if you are looking for a miracle cure - there isn't one - but taking multivitamins is always a good idea.

La voila!


No comments:

Post a Comment

On topic comments are welcome. Junk will be deleted.