Skip to content

mmap vs sbrk, performance comparison

Which of these calls is faster on average? I’ve heard that mmap is faster for smaller allocations but I haven’t heard a comparison of either. Any information on performance for these would be nice. Answer You should tag this with a particular implementation (like linux) since the answer surely var…

Read/Write LabView TDMS files in python under linux

Does anyone know of a way to read and write the National Instruments binary file type (TDMS) in python under linux? I know that NI has a C DLL available, but I don’t know how to access that through python, or if I even can do so under linux. Answer It looks like TDMS isn’t directly supported under…

dos2unix command

I have this script I want to remove “^M” charcaters from many files which are in more subdirectories. I got this: Is there somethig i’m missing? Thanks in advance. Answer I guess you don’t need a for loop. Here is a quick panorama of solutions for files with extension “.ext&#8221…

Bash: How to tokenize a string variable?

If I have a string variable who’s value is “john is 17 years old” how do I tokenize this using spaces as the delimeter? Would I use awk? Answer Use the shell’s automatic tokenization of unquoted variables: If you want to change the delimiter you can set the $IFS variable, which stands …

How to send integer with pipe between two processes!

I am trying to send an integer with pipe in a POSIX system but write() function is working for sending string or character data. Is there any way to send integer with a pipe? Regards Answer The safe way is to use snprintf and strtol. But if you know both processes were created using the same version of compil…