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
The Long Road Home: A Story of Loss, Learning, and Renaissance - PART 4
Wednesday, November 27, 2024
Top Tech Content sent at Noon! How the world collects web data Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, November 27, 2024? The HackerNoon
Top Tech Deals 🏷️ PS5 Slim, 4K TVs, 10th Gen iPad, and More!
Wednesday, November 27, 2024
The Black Friday madness is here! How-To Geek Logo November 27, 2024 Top Tech Deals: PS5 Slim, 4K TVs, 10th Gen iPad, and More! The Black Friday madness is here! Black Friday sales are here, and we
The 165+ best Black Friday deals
Wednesday, November 27, 2024
Windows Super God Mode; Bluesky starter packs; Tech gifts under $100 -- ZDNET ZDNET Tech Today - US November 27, 2024 Black Friday 2024 live blog Best Black Friday deals 2024: 165+ sales live now
⚙️ Neuralink's new trial
Wednesday, November 27, 2024
Plus: Zoom is becoming an AI-first company
Matrix Botnet Exploits IoT Devices in Widespread DDoS Botnet Campaign
Wednesday, November 27, 2024
THN Daily Updates Newsletter cover The AI Value Playbook ($35.99) FREE for a Limited Time Business leaders are challenged by the speed of AI innovation and how to navigate disruption and uncertainty.
The Sequence Chat: Why are Foundation Models so Hard to Explain and What are we Doing About it?
Wednesday, November 27, 2024
Addressing some of the interpretability challenges of foundation models and the emerging fields of mechanistic interpretability and behavioral probing. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
Overcoming Perfectionism: How to Break Free from the Enemy of Progress
Wednesday, November 27, 2024
Discover how perfectionism hinders progress and learn practical strategies to overcome the fear of imperfection, boost productivity, and achieve your goals without getting stuck in the pursuit of
🖤 Laravel Black Friday Deals!
Wednesday, November 27, 2024
The biggest deals of the year Laravel Black Friday Deals View in browser Laravel News Editor Note: We are sending this outside the regular Sunday newsletter schedule because some of these specials end
BetterDev #271 - Memory: The Forgotten History and Why did Windows 95 setup use three operating systems?
Wednesday, November 27, 2024
Better Dev #271 Nov 26, 2024 Hi all, Welcome to thanksgiving issue of BetterDev. Hope everyone had a safe and warm thanksgiving. It's getting so cold these days. If you are in warzone such as
Mapped | Unemployment Rate By U.S. State in 2024 💼
Tuesday, November 26, 2024
As of October 2024, DC and Nevada tied for the highest unemployment rate in the US at 5.7%. Which states saw the lowest rates? View Online | Subscribe | Download Our App FINAL CHANCE - ENDS TONIGHT!