Wednesday, October 21, 2020

Transactions vs. locks

 https://makandracards.com/makandra/31937-differences-between-transactions-and-locking

One good insight this gave me, and in retrospect I think i knew about this, but making a note nevertheless that - the purpose of a lock is to ensure that only 1 thread accesses a critical piece of code. Thus a lock is in it's essence a queue with threadids. 


Sunday, March 15, 2020

Network Isolation of Namespaces

First, here is a quick intro to namespaces. Note that namespaces and cgroups are orthogonal by design.
- Historical discussions
https://lwn.net/Articles/219794/  (2007)
https://lwn.net/Articles/531114/ (2013)

- Modern descriptions:
 https://jvns.ca/blog/2016/10/10/what-even-is-a-container/, and then newer discussion on network namespaces on linux: https://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/
"Each network namespace is a logically a separate networking stack, with separate addresses, separate firewall rules, separate qos policies etc.
Network devices and sockets belong to a particular network namespace and everything else figures out which network namespace you are talking about from the socket or network device."

This has nothing to do with systemd etc.
in this picture we created 3 pairs

  • ns1_veth0, globalns_veth1 (1st pair)
  • ns2_veth0, globalns_veth2 (2nd pair)
  • ns1_veth1, ns2_veth1 (3rd pair)
Originally all pairs exist in the default/global namespace, and we can assign them to different namespaces so that the picture looks like this:


https://etherarp.net/network-isolation-of-services-with-systemd/

Saturday, March 7, 2020

Infra Layers


Got this picture from https://www.theregister.co.uk/2017/12/06/what_is_terraform/, and it was enjoyable for me to see how I moved from the layer above (@Uber) to a layer below (@OCI)

Sunday, February 23, 2020

Processes on Linux

Process ID Description:
0 The Scheduler
1 The init process
2 kflushd
3 kupdate
4 kpiod
5 kswapd
6 mdrecoveryd

(https://unix.stackexchange.com/questions/83322/which-process-has-pid-0

Saturday, February 22, 2020

Linux Networking


I got this picture from https://epickrram.blogspot.com/2016/05/navigating-linux-kernel-network-stack.html?m=0, and the idea is that this is how the interaction between the network card and the driver running on on the CPU (in the interrupt handler?) works. The kernel module copies into a buffer called skbuff, which looks like this:
https://opensourceforu.com/2016/10/network-performance-monitoring/ and the kernel populates (copies) the data into the sk_buff data structure which look like this:

Go to this link for some deep dive on Raw sockets: https://packetstormsecurity.com/files/72743/SOCK_RAW-Demystified.html

Wednesday, February 5, 2020

Concurrency Control

Paraphrasing https://vladmihalcea.com/how-does-mvcc-multi-version-concurrency-control-work/

In Concurrency Control theory, there are two ways you can deal with conflicts:
  • You can avoid them, by employing a pessimistic locking mechanism (e.g. Read/Write locks, Two-Phase Locking)
  • You can allow conflicts to occur, but you need to detect them using an optimistic locking mechanism (e.g. logical clock, MVCC) - this is essentially that same concept of "tokens" I was previously exposed to in the context of distributed locks. 

Tuesday, February 4, 2020

Java

Some links that I am collecting to understand Java better.


Some dependency injection frameworks
  • Guice: I liked this quick video which shows the basic ideas of Guice - modules and "injecting" dependencies into the global map of sorts using BIND, so that later we can use the appropriate class as needed. https://www.youtube.com/watch?v=fe1n8VIXZ-k 

Build Tools: