Skip to content

pthread mutex does not work correctly on macOS

Currently I am learning POSIX threads on Linux. The following example is counting how many 3(int) there are in an integer array, which returns a correct answer on CentOS 6.5 but a wrong one on macOS 10.12.4. The answer should be 64 * 1024 * 1024 / 2 = 67,108,864 / 2 = 33,554,432. But the answer on macOS is

Open MPI error when setting up a cluster with more than 3 hosts

We cannot run a program in a Open MPI cluster with more than 3 machines. If we run: it works. If we run: We get the following error: Despite of the fact that it looks like a name resolution error, it is not, because slave5 works on the first command. We’ve seen other people reporting the same error with…

Print only a part of the result of a command

I am trying to obtain the status of a httpd service with Centos 7. I want to know if i can print only the value of Active, that in this example is inactive (dead) This is the command that i am using: This is the result of that command. This is the output that i a want: inactive (dead). Answer

Receive (recv) full request (e.g. curl HTTP)

How should this be done? I want to receive a (rather long) HTTP request and cannot get this to work. The problem: Without flags, recv does not read the whole message. I guess this is normal behavior. From what I understand using the MSG_WAITALL flag causes it to block until everything is received. However, in…

How to force yum to update only to exact minor OS version

I have a default AWS image with the version CentOS 6.7. If I run I am getting CentOS 6.9. Is there any way to force yum to update only to version 6.8 and not 6.9? Answer Yes it is possible. Follow these steps: Find a mirror that is closer to you using: http://mirrorlist.centos.org/?release=6&arch=x86_64&a…

What does it mean by using ‘source ‘ command in linux?

After creating virtual environment why do we need to fire source command ? What is the use of source command in general in linux ? Answer source : it will read file and execute cmd in file, in current shell environment. usually it’s used to add some environment vars. for example.