RSSAmplifier

Blog

Exploring blog of a Software Engineer

There are so many things we do not know

phamlh.wordpress.comRSS feed ↗8 posts

Latest posts

Output path of Google Protobuf Compiler

This blog explains the behavior of the Google Protobuf Compiler (protoc) about where it output the generated files.

How does CPU predict a branch?

One of the biggest problems for all modern CPUs is the branch prediction. As pipelines are getting longer, the cost of a misprediction will be more expensive. Let's dive into this and explore some implementation techniques of branch prediction!

The Branch Predictor does not work on branch instructions

I used to think that branch prediction only works on branch instructions, or at least instructions, but I later discovered that this was only a small part of the story. In this blog post, I will attempt to clarify this misconception and share what I have learned about how branch prediction works as a critical part of modern CPUs.

Introduction to Modern Processor Architecture (Part 1)

Welcome to the first article in a series about exploring perf, the powerful Linux performance analysis tool. As I delved into perf, I noticed that much of its documentation is scattered across the internet, making it challenging to grasp the full scope of its capabilities. What I feel lacking was a bridge between the high-level software perspective and the low-level architecture that perf provides…

In python everything is an object.

I started learning python for production code today, let's mark this day with some naïve explanation of a trainee python programmer. In python everything is an object.

ReadFile error 998 ERROR_NOACCESS

ReadFile( _In_ HANDLE hFile, _Out_writes_bytes_to_opt_(nNumberOfBytesToRead, *lpNumberOfBytesRead) __out_data_source(FILE) LPVOID lpBuffer, _In_ DWORD nNumberOfBytesToRead, _Out_opt_ LPDWORD lpNumberOfBytesRead, _Inout_opt_ LPOVERLAPPED lpOverlapped ); ReadFile function will verify input buffer at lpBuffer before starting the actual reading operation. So, even if the file s real size is 1 byte,…

How NSIS works

NSIS is a script language, in general, it will read a script file and produce an installer (and uninstaller as well). Let’s dig into NSIS source code. Overview A NSIS installer can be separated in 5 parts: . The exe head: A complete exe file, pre-built for each compression method. . The first header structure: Continue reading How NSIS works

NSIS plugin call for C++

Here is the common signature for all NSIS function: extern C __declspec(dllexport) void _cdecl name( HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) Basically, this is what the NSIS core engine passes function parameter to the plugin call. For example, when we call plugin_a with plugin_a::do_something \NOUNLOAD $0 $1 , what the core engine Continue…