I encountered a strange difference in the behavior of a program using pthreads between Linux and Mac OS X. Consider the following program that can be compiled with “gcc -pthread -o threadtest threadtest.c”: Running the resulting executable on a 4-core Mac OS X machine results in the following behavior: Note that the number of actual cores is probably not even
Tag: macos
Is it necessary to write a “portable” if (c == ‘n’) to process cross-platform files?
This thinking comes from a discussion about a practical problem Replacing multiple new lines in a file with just one. Something wrong happened while using a cygwin terminal running on a windows 8.1 machine. Since the end-of-line terminator would be different, like n, r, or rn, is it necessary to write a “portable” if(c==’n’) to make it work well on
confusing segmentation fault involving ldap_url_parse function from openldap library
On a CentOS 6.6 server the following code compiles (with gcc version 4.4.7 or with clang version 3.4.2) without incident but results in a segmentation fault when run: However if I modify it to remove the string declaration, like so: then it runs without incident as well. On my Mac OS X 10.10.3 (Yosemite) both versions (with and without the
Does Java JVM use pthread?
Does JVM on Mac OS X use pthread to create threads? What about on Linux distributions, is it now default way to create threads for JVM on all distributions? Answer Yes, HotSpot JVM (i.e. Oracle JDK and OpenJDK) uses pthreads on Linux and on Mac OS X.
Limit a set of processes’ CPU and memory usage
Browsing the web has low priority for me, and so I would like all the processes that deal with it to be low priority, too. Is this approach a valid one? Open a console window with the nice command. Launch the browser from this console. Will the program launched from this console inherit the niceness of the console itself? Answer
How to mount image using mount(2)
I cannot mount some IMAGE on the MacOSX 10.10 via C function mount(). I use following code And when I start the program I get the error “mount() is failed! Error(Operation not supported by device).” And image was mounted if I use the following command: Also, when I use mount() on the Linux – All is OK. Following Linux code:
How to set the path that a .so library will search for other .so libraries?
I have a libA.so that depends on libB.so, which is located at ../libB/ (from libA.c). I’m trying to compile things in such a way that I don’t have to set any environment variables. I have: This compiles fine. When I run a program that loads libA with dlopen I get: so libA is not finding libB at runtime. I found
Python doesn’t find a directory using the home sign ~ [duplicate]
This question already has answers here: os.makedirs doesn’t understand “~” in my path (3 answers) Closed last month. I have created a small Python script to save directories in a side directory, under the current user. I am running on Mac but production is Ubuntu My problem is the it doesn’t manage to identify the dir with the home sign
SCP gives “File or directory not found”
I am having an issue. I am using the SCP command to transfer files from my desktop of my mac osx too my virtual server. The thing is I ran the command and successfully transferred one file from my desktop over to the server, no problem. So i use the same command which is: scp filename_I_want_to_transfer user@serverip: So basically that
bash command not found when setting a variable
I am writing a shell script where I am setting few variables, whose value is the output of commands. The errors I get are: now, I did read other similar questions and based on it, I tried various things: spliting command into two calls tried using backticks tried using $() But in every case the command output is getting executed.