How To Benefit From Computer Science In Real Life? (I) - An illustration featuring one person heating glass in a flaming furnace, whereas another person is blowing and shaping a curvy-looking piece of glass artwork. Along with the illustration, the following text is presented: "Glass Blowing Using Computer Science?"

People all over the world already benefit from computer science every single day. Computers and computing devices have made it out to every walk of life, after all. One need not even know how computer science works to benefit from it. If this is the case, then what is the purpose of this essay, you ask?

Well, firstly, this essay (series) aims to leverage fundamental computer science concepts to improve real-life experiences. In this sense, it focuses on real-life applications of the best of computer science. Secondly, it also aims to strengthen the fundamental understanding of how computing works.

For a project that I started recently, I needed to explore various computer science concepts in the context of a real-life setting. This is what triggered this essay series. Now that you know about the background, let us begin.

This essay is supported by Generatebg

A product with a beautiful background featuring the sponsor: Generatebg - a service that generates high-resolution backgrounds in just one click. The description says "No more costly photographers" and displays a "Get Started" button beneath the description.

Can Hand-Blown Glass Benefit from Computer Science?

As a relatable example of a real-world application, I will be using the process of glass-blowing by hand. Imagine that you are an artist who is in the business of selling hand-blown glass art. To produce one piece of glass artwork, you go through the following production process:

1. Pre-heat glass in a pre-heating furnace to about 2000°C — 20 minutes.

2. Roll glass on shaping plate (marver) using a blowpipe — 10 minutes.

3. Blow glass to requisite art shape using the blowpipe — 10 minutes.

4. Cool down the glass artwork in a special cooling furnace — 20 minutes.

How To Benefit From Computer Science In Real Life? (I) — A linear production schedule that features pre-heating from 07:00 to 07:20, rolling from 07:20 to 70:30, blowing from 07:30 to 07:40, and cooling from 07:40 to 08:00.
Production Schedule — illustration created by the author

As you can see, the entire process involves 4 steps that span 60 minutes in total. As an artist, you love the art that can create using this process. However, you are also a business person. So, you wish to see if you can increase productivity (number of artwork pieces you produce in an hour) by altering the process a little.

For this purpose, you turn to the world of computer science!


The World of Parallelism

In modern computers, information retrieval from storage devices is significantly slower than how fast processors can handle information. So, when the computer retrieves/sends information from/to storage devices, the processor is designed to do meaningful work instead of waiting idly. This is one of the hallmark examples of the concept of parallelism in computer science.

You’ve probably heard a thousand times that human beings are bad at multi-tasking. We are not computers, after all. So, how can you improve your glass artwork production rate without suffering the burden of multi-tasking? Well, there are two prominent ways to go about this.

To explore the first way, all we need to do is ask is the following question:

“Is there any step in the glass-blowing process that is parallelizable?”

Improving the Production Rate by Splitting Tasks

Let us look at the first step — pre-heating glass. The pre-heating oven surely has room for pre-heating an amount of glass that is required for more than just one piece of artwork. So, all you will need to do here is pre-heat more glass than you would normally do.

The second and third steps (rolling and blowing) are limited by the artist (you). At first sight, they appear as if they are not parallelizable. But what if you hire an apprentice and teach him/her your artistic ways. Then, all you’ll need to do is buy an extra blowpipe and safety equipment. If you do this, two people can work on two pieces of artwork simultaneously.

When it comes to the cooling furnace, it surely features enough room to cool down more than one piece of artwork. So, your productivity schedule at the end of this improvement would look like this:

How To Benefit From Computer Science In Real Life? (I) — A linear production schedule that features pre-heating from 07:00 to 07:20, rolling from 07:20 to 70:30, blowing from 07:30 to 07:40, and cooling from 07:40 to 08:00. This time, the entire schedule is split between you and a coworker such that each task is done twice simultaneously. This doubles the output.
Improved Production Schedule — illustration created by the author

By splitting each parallelizable task, you just doubled the production rate per hour! However, there are a few caveats here which we will need to discuss before we finalise this solution.

The Perils of Splitting Tasks

The first obvious thing to note is that splitting tasks comes with explicit costs. If you choose this solution, you will need to pay another person and buy extra safety-equipment, blowpipes, etc.

Beyond these costs, there are also implicit costs that are not quite obvious. When you split the tasks, two (or more) people would be working simultaneously. These people would need to communicate and coordinate with each other to work efficiently. For instance, you would not want to pick-up the wrong bob of glass from the pre-heating furnace.

This class of communication/coordination problems is common in the computer science world, and is known as coordination overhead in the context of parallelism. Furthermore, if there are tasks in the production sequence that are non-parallelizable, then the production process has limits to how much it can be accelerated.

For instance, let us say that your cooling furnace has room only for 3 artwork pieces. Then, it would be a bottleneck if more than three people started splitting the tasks of the production process. This point might sound very obvious when I explain it this way in the context of this example. However, the complexities of real-life tasks could be very deceiving.

How Not to Benefit from Computer Science in Real Life?

I once worked in a team building a numerical model, where my manager ordered my team to split the numerical model among multiple members. As we were struggling with coordination and miscommunication, I remarked that this was probably a bad idea. One of my clever teammates replied with the following witty remark:

“Our manager is the type who believes that ten pregnant women can deliver one baby in one month.”

Moral of the story: Don’t be THAT manager! The thought that throwing more resources at a parallelizable process would only make it faster is a potential trap. Splitting-up tasks will eventually stop being useful IF part of the problem is NOT splittable.

Computer architect, Gene Amdahl did ground-breaking work on the limits of parallel computing, and his model eventually came to be known as Amdahl’s law. Check it out if you are interested in the technical aspects of this limitation.

Let us say that you do not wish to hire an apprentice or buy new equipment. You wish to explore options that will hasten your production output without spending more money. Then, we turn to the second prominent method of parallelism — Pipelining.


The World of Pipelining

Pipelining improves process efficiency by running simultaneously, multiple tasks that are at different levels of completion. It is probably significantly easier to understand if you look at an illustration of this concept.

Consider the fact that you aim to produce more than one piece of artwork in a day. Let us say that each piece of artwork comprises a batch. Batch-2 follows batch-1, batch-3 follows batch-2, and so on. Except that batches need not necessarily follow each other sequentially. Check out the upgraded production schedule below:

How To Benefit From Computer Science In Real Life? (I) — The upgraded schedule features pre-heating of all three batches (B1, B2, and B3) from 07:00 to 07:20, B1 rolling: 07:20 to 07:30, B1 blowing: 07:30–07:40, B2 rolling: 07:40 to 07:50, B2 blowing: 07:50 to 08:00, B1 cooling: 07:40 to 08:00, B3 rolling: 08:00 to 08:10, B3 blowing: 08:10 to 08:20, B2 cooling: 08:00 to 08:20, and B3 cooling from 08:20 to 08:40.
Upgraded Production Schedule — illustration created by the author

You can see that the pre-heating furnace heats glass for all three batches simultaneously. From 07:20 Am until 07:40 AM, you work on rolling and blowing batch-1. As batch-1 goes into the cooling furnace, you can get started with blowing and cooling batch-2.

This means that the cooling step of batch-1 and rolling/blowing steps of batch-2 run simultaneously. For illustration purposes, I’ve assumed that it takes negligible time for you to switch from placing batch-1 in the cooling furnace and start rolling batch-2.

In conclusion, this schedule appears a bit paradoxical. Each batch still takes 60 minutes to complete. But you end up with 3 pieces of artwork in 100 minutes. How can that be (more on that in a bit)? You went from 1 piece of artwork in 1 hour to 1.8 (approximately) pieces of artwork in 1 hour.

That is the power of pipelining. It focuses on the entire task sequence and not just the unit task — a big picture approach.

Two Different Speeds: Latency and Throughput

The apparent paradox where each batch still took 60 minutes, but you ended up with more than 1 artwork-piece in 1 hour can be explained by the computer science concepts of latency and throughput. Latency focuses on a unit task — it measures how fast each unit task can be completed. On the other hand, throughput focuses on the entire process — it measures how fast the entire process can complete tasks.

So, while splitting tasks between workers improves latency, pipelining the process improves throughput. In our example, pipelining did not improve the latency. That is, each task still took the same amount of time as before. Yet, the throughput increased due to more efficient scheduling.

How to Benefit from Computer Science — Final Remarks

The concept of parallelism is very useful in improving process efficiency. The only requirement is that the process involves repeating patterns. As long as you can observe patterns, you could implement parallelism using the following approach:

1. See if there are parallelizable unit tasks, and split them between different workers/processors.

2. If there are non-parallelizable tasks in the process, there exists a limit to how many workers/processors can split the unit tasks (that are parallelizable) efficiently.

3. Do not fall into the trap of thinking that throwing more resources at a parallel process would only make it go faster. Compute coordination overhead and schedule wisely.

4. If your process allows for different tasks to be solved simultaneously, consider pipelining. It can be a useful tool to save time.

I have had the privilege of working on processes that require zero communication overhead. In the computing world, these processes are described as “embarrassingly parallel”.

In the real world, it is seldom that you come across such processes. But as long as you follow the guidelines that I’ve outlined above, you should be able to benefit from parallelism.

If this essay helped you solve (or gain insights towards) some sort of unique problem, do share the nature of the problem in the comments. In the future, I will be covering more computer science concepts that we can benefit from in real life as a series of essays.


If you’d like to get notified when interesting content gets published here, consider subscribing.

Further reading that might interest you: Why Are Analogue Computers Really On The Rise Again? and How To Really Understand The Concept Of An Algorithm?

If you would like to support me as an author, consider contributing on Patreon.

Street Science

Explore humanity's most curious questions!

Sign up to receive more of our awesome content in your inbox!

Select your update frequency:

We don’t spam! Read our privacy policy for more info.