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
Import AI 399: 1,000 samples to make a reasoning model; DeepSeek proliferation; Apple's self-driving car simulator
Friday, February 14, 2025
What came before the golem? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
Defining Your Paranoia Level: Navigating Change Without the Overkill
Friday, February 14, 2025
We've all been there: trying to learn something new, only to find our old habits holding us back. We discussed today how our gut feelings about solving problems can sometimes be our own worst enemy
5 ways AI can help with taxes 🪄
Friday, February 14, 2025
Remotely control an iPhone; 💸 50+ early Presidents' Day deals -- ZDNET ZDNET Tech Today - US February 10, 2025 5 ways AI can help you with your taxes (and what not to use it for) 5 ways AI can help
Recurring Automations + Secret Updates
Friday, February 14, 2025
Smarter automations, better templates, and hidden updates to explore 👀 ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
The First Provable AI-Proof Game: Introducing Butterfly Wings 4
Friday, February 14, 2025
Top Tech Content sent at Noon! Boost Your Article on HackerNoon for $159.99! Read this email in your browser How are you, @newsletterest1? undefined The Market Today #01 Instagram (Meta) 714.52 -0.32%
GCP Newsletter #437
Friday, February 14, 2025
Welcome to issue #437 February 10th, 2025 News BigQuery Cloud Marketplace Official Blog Partners BigQuery datasets now available on Google Cloud Marketplace - Google Cloud Marketplace now offers
Charted | The 1%'s Share of U.S. Wealth Over Time (1989-2024) 💰
Friday, February 14, 2025
Discover how the share of US wealth held by the top 1% has evolved from 1989 to 2024 in this infographic. View Online | Subscribe | Download Our App Download our app to see thousands of new charts from
The Great Social Media Diaspora & Tapestry is here
Friday, February 14, 2025
Apple introduces new app called 'Apple Invites', The Iconfactory launches Tapestry, beyond the traditional portfolio, and more in this week's issue of Creativerly. Creativerly The Great
Daily Coding Problem: Problem #1689 [Medium]
Friday, February 14, 2025
Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. Given a linked list, sort it in O(n log n) time and constant space. For example,
📧 Stop Conflating CQRS and MediatR
Friday, February 14, 2025
Stop Conflating CQRS and MediatR Read on: my website / Read time: 4 minutes The .NET Weekly is brought to you by: Step right up to the Generative AI Use Cases Repository! See how MongoDB powers your