How To Benefit From Computer Science In Real Life? (I)
Published on June 13, 2022 by Hemanth
--
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.
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.
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:
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:
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.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-advertisement
1 year
Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category .
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
CookieLawInfoConsent
1 year
Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie.
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Cookie
Duration
Description
_gat
1 minute
This cookie is installed by Google Universal Analytics to restrain request rate and thus limit the collection of data on high traffic sites.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Cookie
Duration
Description
__gads
1 year 24 days
The __gads cookie, set by Google, is stored under DoubleClick domain and tracks the number of times users see an advert, measures the success of the campaign and calculates its revenue. This cookie can only be read from the domain they are set on and will not track any data while browsing through other sites.
_ga
2 years
The _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors.
_ga_R5WSNS3HKS
2 years
This cookie is installed by Google Analytics.
_gat_gtag_UA_131795354_1
1 minute
Set by Google to distinguish users.
_gid
1 day
Installed by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously.
CONSENT
2 years
YouTube sets this cookie via embedded youtube-videos and registers anonymous statistical data.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Cookie
Duration
Description
IDE
1 year 24 days
Google DoubleClick IDE cookies are used to store information about how the user uses the website to present them with relevant ads and according to the user profile.
test_cookie
15 minutes
The test_cookie is set by doubleclick.net and is used to determine if the user's browser supports cookies.
VISITOR_INFO1_LIVE
5 months 27 days
A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.
YSC
session
YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.
yt-remote-connected-devices
never
YouTube sets this cookie to store the video preferences of the user using embedded YouTube video.
yt-remote-device-id
never
YouTube sets this cookie to store the video preferences of the user using embedded YouTube video.
Comments