BetterDev #198 - PostgreSQL: Understanding Deadlock and basics of Futexes
Better Dev #198 May 03, 2021
Hi all, Hope everyone has a great week ahead. This week we focus on deadlock and concurency primitive. Thank you to the readers who have bought me a coffee, really appreciate that ❤.️
Many might have seen PostgreSQL issue the following error message: “ERROR: deadlock detected”. But what does it really mean? How can we prevent a deadlock and how can we reproduce the problem? Let’s dive into PostgreSQL locking and understand what deadlock and deadlock_timeout really mean.
Concurrent programming requires synchronization. We can’t have more than one thread accessing data at the same time; otherwise, we end up with a data race. The most common solution is to wrap the critical data access in a mutex. When misused, it can cause a program to run worse in threaded mode than it would have single threaded!
Now we know about mutex, then how about futexes, which are popup sometime especially when you are working with strace. Futex mechanism was proposed by Linux contributors from IBM in 2002 [1]; it was integrated into the kernel in late 2003. The main idea is to enable a more efficient way for userspace code to synchronize multiple threads, with minimal kernel involvement.
(or any static file hoster). So how do you use a database on a static file hoster? Firstly, SQLite (written in C) is compiled to WebAssembly. SQLite can be compiled with emscripten without any modifications, and the sql.js library is a thin JS wrapper around the wasm code. It also leverage HTTP Range header, which we cover in issue #196
We use cd
all day long. It’s a built-in shell primitive. But at the same time, we also have /usr/bin/cd
.What purpose does it serve? Another deep dive on this is cd is not a program, check it out too
With an increasing number of breaches, intrusions, and data thefts, securing a web application is extremely important. On the other hand, programmers often do not have a strong grasp of how attacks work and how to mitigate them. This post attempts to close that gap a little.
JWT is gaining popularity due to its convenience use to hold information without issuing an auth storage. Naturally, it has a lot of attacking vectors. Let’s learn about those attacks so we can use JWT securely
The post target data scientist to use SQL instead of analyze data with Panda. But we can see how thing are done in raw SQL to extract information out of SQL database Running and Cumulative Aggregation, one of topic in this article can be quite useful to analyze the growth or trend.
Back in old day, we take picture use film in camera. To create different look of image, we used a different film. Modern mirrorless cameras from Fujifilm have film simulation presets that digitally mimic the style of a particular film stock. So how these simulations were achieved? A good post to learn about image maniupulation, vector
Github praises feature flags in release rollout. This is a better post in my opinion in this topic because it also talk about the cost of feature flags.
We don’t usually include article that just show code without technical deep dive but this has some useful ones so we include it here
Code to read
a pure Python from-scratch zero-dependency implementation of Bitcoin for educational purposes.
Verify email via Regex, DNS, SMTP, MX blacklist. A useful way to fightbox and ensure no typo on email.
RubyUse simple JavaScript Strings and Arrays to generate rhythms and musical patterns.
JavaScripta single-pass compiler for a tiny subset of the Go programming language – just enough to compile itself. It outputs (very naive) x86-64 assembly, and supports just enough of the language to implement a Mugo compiler.
GoConvert images to computer generated art using delaunay triangulation. Kind of a fun code to read about image manipulation
GoVideo
If you are into Software-Defined Radio then this is a great resource to dive into it.
Tools
Run SQL queries on your Terraform infrastructure. Query resources and analyze its configuration using a SQL-powered framework.
steps you through the local branches of a repo one at a time, outputting the following information about each: last commit, last author etc then you can select to delete them. Useful to cleanup when you hacked a lot on a repo.
Fast, modern, easy-to-use network scanner. If you use nc, nmap a lot, absolutely give this a try.
Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes
You can view this issue in web browser.
If you have any suggestion/feedback, do tell me by replying to this email. I read them all.
No longer want to receive these emails? Unsubscribe
Older messages
BetterDev #197 - Postgres error: invalid byte sequence for encoding
Monday, April 26, 2021
Better Dev #197 Apr 26, 2021 Hi all, Hope everyone has a great week ahead. Enjoy this week issue with articles cover a wide ranges of knowledge: from hardware to network to SRE and algorithm. Thank you
BetterDev #196 - Allow arbitrary URLs, expect arbitrary code execution and curl those funny ipv4 addresses
Tuesday, April 20, 2021
Better Dev #196 Apr 19, 2021 Hi all, This week is an issue of network knowledge, tips and tricks. The fundamental of how computers can talk to each others :-). If you enjoy this newsletter, make a
BetterDev #194 - This man thought opening a txt file is fine, he thought wrong. macos cve-2019-8761
Monday, April 5, 2021
Better Dev #194 Apr 05, 2021 Hi all, This week, We had some interesting low level links about font rendering, IP parse, and a few tools which I'm sure will make you engineer life easier, checkout
BetterDev #191 - A developers guide to HIPAA compliance and application development
Monday, March 15, 2021
Better Dev #191 Mar 15, 2021 Hi all, This week, We had some interesting tools which I'm sure will make you engineer life easier, checkout tools section. If you enjoy this newsletter, make a small
BetterDev #190 - Common Nginx misconfigurations that leave your web server open to attack
Monday, March 1, 2021
Better Dev #190 Mar 01, 2021 Hi all, I hope you enjoy this week's newsletter. We had some interesting links to help secure Nginx and practice breaking and fixing K8S. If you enjoy this newsletter,
You Might Also Like
Arc for Windows is better than Chrome
Wednesday, May 1, 2024
Adobe bug bounty; Rabbit's first R1 software update; Dream podcaster mic -- ZDNET ZDNET Tech Today - US May 1, 2024 placeholder Arc browser is now available for Windows and it's so much better
Is TikTok trying to get banned from the App Store early?
Wednesday, May 1, 2024
TikTok is offering some users a way to buy its in-app tipping tokens outside of Apple's App Store. View this email online in your browser By Alex Wilhelm Wednesday, May 1, 2024 Good morning, and
Get Compliant in 2024 - Download Ultimate PAM Policy Template Today
Wednesday, May 1, 2024
Privileged Access Management Policy Template What are your PAM policies for 2024? Get ready for the New Year Is your approach to Privileged Access Management as current and effective as it could be? In
What's new in Autodesk Inventor 2025?
Wednesday, May 1, 2024
Post from Syncfusion Blogs on 05/01/2024
Wednesday, May 1, 2024
New blogs from Syncfusion Chart of the Week: Creating a WPF 100% Stacked Area Chart to Visualize the World Vehicle Production in Major Countries By Karthikeyan V Let's visualize the world vehicle
New U.K. Law Bans Default Passwords on Smart Devices Starting April 2024
Wednesday, May 1, 2024
THN Daily Updates Newsletter cover Webinar -- Uncovering Contemporary DDoS Attack Tactics -- and How to Fight Back Stop DDoS Attacks Before They Stop Your Business... and Make You Headline News.
Our verdict on Beats' $200 Solo 4 headphones
Wednesday, May 1, 2024
The Morning After It's Wednesday, May 01, 2024. Beats today announced the Solo 4, a $200 set of familiar-looking cans with significant upgrades inside, even if they look almost entirely the same as
Power BI Weekly #256 - 1st May 2024
Wednesday, May 1, 2024
Power BI Weekly Newsletter Issue #256 powered by endjin Welcome to the 256th edition of Power BI Weekly! No announcements this week, so we'll jump straight into the highlighted articles. Firstly,
Apple AI browser 🌎, Tesla fires Supercharger team ⚡, new sudo replacement 👨💻
Wednesday, May 1, 2024
Apple is testing a version of its Safari web browser that includes an AI-powered tool called Intelligent Search Sign Up |Advertise|View Online TLDR Together With Modern Treasury TLDR 2024-05-01 The
JSter #218 - Libraries and more
Wednesday, May 1, 2024
All JavaScript is good JavaScript. I'm close to done with my SurviveJS rework. The new site will have more content while being much lighter and faster to compile so that's all good. Libraries