Peter's sandbox
to develop skills, share ideas and experience, etc

Silence?

In the recent 3 months 21 days I didn’t write anything here. It is because there a few things that going on. I changed role within the company, from Customer Operation Engineer I became a Software Engineer for the Hadoop project, sustaining the released versions, backporting fixes for issues and bugs, so nowadays I learn the tricks and hows of coding, Jenkins, build systems and so on.
In June we started to renew a big part of our house, with all the dis/advantage of it: dust, trash, broken tiles, missing parts of different things, reorders, new and fresh look, et cetera. Soon it’ll be done, the next is repainting the walls and when that is also finished, I’ll return and continue writing. I have ideas and a few drafts I must work on :)

Increasing VO2 max

I’m not a professional runner. I never was. Actually 6 years ago I hated running and I didn’t understand what’s the point of it; going somewhere without finish line. But 5 years ago it changed, I gave it a chance and found a goal that I achieved a year later: running a half marathon.
Nowadays, especially during the COVID-19 quarantine, it’s one of the best ways to keep my health. But distance running takes a lot of time that I don’t want to invest into this sport; so instead of going for more and more kilometers now my goal is to increase VO2 max.

Increase what?

The VO2 max “is the maximum rate of oxygen consumption measured during incremental exercise; that is, exercise of increasing intensity. The name is derived from three abbreviations: “V” for volume, “O2” for oxygen, and “max” for maximum.” - Wikipedia
Increasing it means your physical performance and endurance gets better; your muscles burn oxygen to generate power, and, naturally, the more oxygen your muscles can burn the more power they can generate for you, thus, you’ll have more power. The two main factors that have effect on the value are the oxygen transport system (lungs and the heart that circulates the blood) and the muscles (that will utilise the oxygen-filled blood, they must have high capillary density). So, working on improving this performance indicator means your lungs, heart and muscles will also improve along the way.

How to do it?

There are two easy ways: interval- and hill runs. You can find plenty of training plans and tips, I won’t write yet another one; plus running isn’t my profession, others know things in this topic much better, believe me.
In my case, hill run training is the most obvious, where I live I can find an upward within 200 meters in any direction and even though I include it in every session, based on my experience, after a time the endurance increases slowly. I didn’t run for a bit more than half a year in 2019 and my VO2 max fell from 50 (in July) to 46 (in November). True, I measure it with my watch, not in a laboratory, still, I like to know how my performance evolves and it’s a way to see it. So, since November I try to go on as much hills as I can (I have 90 meters elevation per exercise, in average), and my indicator went back to 49 recently, in April.

How to determine it?

The only trustworthy way is in a laboratory. They have the equipment to record everything (amount of air you breath in and out, for example) it requires to calculate your accurate VO2 max; every other device gives only approximate value. Nowadays most of the fitness- and smart watches capable to do it, you need to start a run or cycling activity and maintain a fast pace for an extended time. Different equipments do it differently, you need to do some research for yours to know the exact process or calculation.

Things worth reading

How to Boost Your Cardio Fitness - Runner’s World
VO2 max: Everything you need to know - cnet
How Important is VO2 Max? What Does Yours Actually Mean? - RunnersConnect

... or watching

What Is VO2 Max And How Can You Increase It? - The Running Channel
What’s The Fastest Way To Increase VO2 Max - EndurElite
How To Improve Your VO2 Max - Global Cycling Network

Authentication and Authorisation

In the world of IT, information security is something you can’t go past, having the basic understanding is a must. One building block of it is authentication and authorisation; to know what do they mean, how they effect the users and what they provide for them.

Authentication

Authentication is identifying yourself. In the real world, you have your ID card that carries your unique, personally identifiable information like name, birth day and place, mother’s name, etc. But you can’t use your ID card on a computer, so there must be an other identifier. The most common one is a username, and to protect the account, a unique password. The goal is to prove you are who you say you are.

Authorisation

After you are successfully authenticated, you gain access to different things; you have the authority to use resources. The system where you identified yourself provide you permission for example to print documents, browse a shared directory on the company’s network, read and answer your e-mails, send a post on a forum. If you don’t have the permission, you get an “Access denied”, “Permission denied” or similar message. Authorisation is about what permissions you have, what can you do.

Authentication methods

Without listing every option, I would like to list the most used ones.

  • Password: I think everybody knows it. You have a username and either a self- or a system generated password.
  • Biometric authentication: nowadays it’s the 2nd most used method, smartphones allow access after recognising the user’s recorded fingerprint or face.
  • Token: Usually companies use this method where a purpose-built physical device shows a random string or -numbers, it must be provided by the user after entering the username.

Memory Management on Android

In 2017 I started to follow a free and open source project that aims to protect user privacy and -data on Android systems. It is Blokada, an ad- and tracking blocker. Since then I help it to grow its user base, have big communities on various platforms, manage the default DNS- and host lists.
Recently I have tried to familiarise myself with its code and was especially interested in the memory management, so I thought I’d optimise that a bit. Here is what I have learnt along the way:
On Android, applications can’t utilise the full RAM of the device, instead, every app the user start gets a portion of it. Because Android apps are based on Java, this allocated memory is called the same way as in Java: heap.

What is heap and how big is that?

Simply phrased, heap is the memory of the running application and similarly to the memory of a physical machine (PC or notebook), it has an upper limit. The manufacturer (or in custom ROMs the maintainer) decides and defines the maximum size; no app nor system configuration can change that. Newer devices have more RAM, hence, bigger heap can be allocated without problems.
The app’s memory is allocated at its start up and lasts during its runtime; so while that is not closed, killed, crashed or the device is not restarted. If the program is sent into the background, the heap isn’t totally cleared, a small portion will remain allocated.
So, how is that you can start a lot of apps but they don’t run into memory problems?

Heap management

The system tracks each memory allocation and if it determines that a piece isn’t used anymore, it frees that up removing objects that are not referenced. The mechanism that reclaims unused memory is called Garbage Collection (shortly: GC) and it is triggered by the underlaying Android system; it can’t be started manually.
The GC ensures the program has minimal footprint: it is necessary to be able to start other applications, have enough space in RAM to allocate heap for newer ones. This is how you can run a lot of them in parallel.
But what happens when something needs more resource than it can access? The application crashes with an OutOfMemory (shortly: OOM) exception and the allocated memory chunk is cleared up totally.

Additional things

If you want to read more in this topic, please refer to the Overview of memory management.
It’s possible to see the set limit with the maxMemory() method.

Hello World!

Hello and welcome to my hobby project and -blog, this is the very first entry here. The plan is to have technical and non-technical articles as well, based on my interest and current focus, furthermore it will carry my up-to-date Curriculum Vitae. The ‘About me’ section will be uploaded (hopefully very) soon, but until that, let me introduce myself shortly: I’m Peter, a professional IT guy with support, OS administration (mostly Linux), virtualisation, Big Data and some marketing background and experience. I have had the chance to work with AIX 5L, RedHat Linux, VMware, Cloudera CDH components, Amazon AWS, Microsoft Azure. Right now I’m interested in Docker and Kubernetes, security and cryptography.
Regarding my hobbies, I like doing different kind of sports. Nowadays I run a few kilometers when my free time allows it, previously I had experience with Krav Maga, MMA, weight-lifting, wall climbing and kempo.

So, let’s kick(start) it off.