Tag: linux

Linux Memory Management Tricks

Tips to Improve Dynamic Memory Performance Instead of using memset() to initialize malloc()’ed memory, use calloc(). Because when you call memset(), VM system has to map the pages in to memory in order to zero initialize them. It’s very expensive and wasteful if you don’t intend to use […]

Internals of Linux Process Signals

Linux Signals A process in Linux is represented as task_struct. A process A sends a signal to process B using system call kill() or kill -<sig num> <pid>. Kernel updates the task_struct of the receiving process B. It changes the signal field with the passed value. The scheduler […]

Find a String in Files Excluding Some Files

— tags: ‘shell, linux, command, development, grep,find’ categories: development — I use the following command to find a string in a Go repo. The vendor directory is not needed, so skip it. $ find . -type f |grep -v vendor|cut -d”:” -f2|xargs grep -n my_search_string The command find […]