Understanding SMP concept in linux
Does all Linux distribution like fedora13, ubuntu 10.04 Lucid by default enable SMP Linux? On an SMP Linux, which is better to follow- a) multi-process approach versus b) multi-threading approach Does pthread by default create a kernel level thread so that any application can take advantage of LWP as well as SMP? Recently i have started getting into SMP programming, was trying to understand the concepts and experiment examples in Linux.
Understanding SMP concept in linux
Recently i have started getting into SMP programming, was trying to understand the concepts and experiment examples in Linux. When i started around Googling for the same, i came across the below book:
unix systems for modern architectures: Symmetric Multiprocessing and Caching for Kernel Programmers
This books is really good and delivers what i says but i am confused or not clear, if the same concepts applies to Linux also: For eg: virtual cache, do they exist for Linux.
Basically i am seeking advice as to how much this book would be helpful if i am purely working in Linux only environment.
Read more about pthreads, Advanced Linux Programming & syscalls(2), Remote Procedure Calls, Message Passing, shared memory and shm_overview(7), semaphores and sem_overview(7), event loops and poll(2) with the C10K problem, MPI, JSON-RPC, etc.
Of course I am assuming you want to program user-land applications (not kernel modules).
Setting default_smp_affinity on Linux to the correct value, Browse other questions tagged linux smp irq or ask your own question. The Overflow Blog Stack Exchange sites are getting prettier faster: Introducing Themes. Money that moves at the speed of information (Ep. 462) Featured on Meta Testing new traffic management tool
Multithread and SMP Linux
The Linux Kernel is said to be SMP. It is said that processes and kernel threads shall be distributed across processors.
- Does all Linux distribution like fedora13, ubuntu 10.04 Lucid by default enable SMP Linux?
If not, how can one make a kernel level thread using Pthreads. Any references would be much appreciated.
- SMP has been in the kernel for years now. With most modern systems sporting at least two cores, it is almost always in use.
- Which to use depends much more on your problem space than on how many cores you have.
- Yes, Pthreads create kernel-level threads. (If you wanted user-space threads, you could use something like GNU Pth).
Loadable Kernel Module, Step 3: insmod and rmmod. To load the module, we have to execute the insmod command from the source file folder. After this, the name of the driver is added to the /proc/modules file, while the device that the module registers is added to the /proc/devices file. Then we need to create the special character file …
Error «fatal error: linux/smp_lock.h: No such file or directory» during installation of VMWare tools on Ubuntu 12.04.2
I have Ubuntu 12.04.2 LTS installed on a VMware machine on Windows 7 host. I seem to have a problem with Kernel headers when trying to install them
sudo apt-get install gcc make build-essential linux-headers-$(uname -r)
Reading package lists. Done Building dependency tree Reading state information. Done gcc is already the newest version. build-essential is already the newest version. linux-headers-3.5.0-28-generic is already the newest version. make is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.
However, when installing VMware tools I get the following error:
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-28-generic' CC [M] /tmp/vmware-root/modules/vmhgfs-only/backdoor.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/backdoorGcc32.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/bdhandler.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/cpName.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/cpNameLinux.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/cpNameLite.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/dentry.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/dir.o CC [M] /tmp/vmware-root/modules/vmhgfs-only/file.o /tmp/vmware-root/modules/vmhgfs-only/file.c:122:4: warning: initialization from incompatible pointer type [enabled by default] /tmp/vmware-root/modules/vmhgfs-only/file.c:122:4: warning: (near initialization for ‘HgfsFileFileOperations.fsync’) [enabled by default] CC [M] /tmp/vmware-root/modules/vmhgfs-only/filesystem.o /tmp/vmware-root/modules/vmhgfs-only/filesystem.c:48:28: fatal error: linux/smp_lock.h: No such file or directory compilation terminated. make[2]: *** [/tmp/vmware-root/modules/vmhgfs-only/filesystem.o] Error 1 make[1]: *** [_module_/tmp/vmware-root/modules/vmhgfs-only] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-28-generic' make: *** [vmhgfs.ko] Error 2 make: Leaving directory `/tmp/vmware-root/modules/vmhgfs-only'
A voice from the future: I am compiling 5.9.0rc5. The source tree is exactly what came off linux.org. My platform: Ubuntu 20.04.1 (upgraded from 18.04.5 a week ago. No VmWare, just a pristinekernel tarball, and yet:
DKMS make.log for virtualbox-guest-6.1.10 for kernel 5.9.0-rc5 (x86_64) Wed 16 Sep 2020 01:35:06 AM EDT CC [M] /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/VBoxGuest-linux.o CC [M] /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/VBoxGuest.o CC [M] /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/common/string/strformatrt.o CC [M] /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/combined-agnostic.o In file included from /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/VBoxGuest-linux.c:36: /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/r0drv/linux/the-linux-kernel.h:141:11: fatal error: linux/smp_lock.h: No such file or directory 141 | # include | ^~~~~~~~~~~~~~~~~~ compilation terminated.
The error is in TWO places;
/usr/src/virtualbox-guest-6.1.10/vboxsf/r0drv/linux /usr/src/virtualbox-guest-6.1.10/vboxguest/r0drv/linux
Find the old, forgotten lineS, surround with #if 0 and #endif , run make install in the kernel source directory and be done. I put the changes into revision control, etc. but these steps are not vital.
Oh, the Copyright is Oracle now, updated to 2020, but the code is pure 2003.
VMWare does not change their tools as fast as the kernel generators release them. Thus, in this case, you’ll have to run without VMware tools installed until VMWare gets their act together and updates VMTools for the 3.5.0-28 kernel level.
I’d contact Vmware and complain and ask them for an ETA on the change.
It might be they already have a current VMtools update that is available but Vmcenter software might not have been updated yet. Thus you could also ask your sys administrator for VM infrastructure if the latest VMcenter has been installed.
I do not think is the kernel headers, since smp_lock.h is not present on my Ubuntu guest and I have linux-headers-3.2.0-45-generic on Ubuntu 12.04 and I was able to install the VMWare tools without problems.
I read here that smp_lock.h is not there since 2.6.39, so I think you have an old version of the VMware tools or an old version of VMWare Player or VMWare Workstation.
You can check here for more options: https://help.ubuntu.com/community/VMware/Tools
Fixed (for me). I had the same problem when installing Guest Additions on a new machine (Ubuntu 21.04). This was resolved by downloading the latest Virtual Box 6.1.26 (I was on 6.1.8). Running GAs_6.1.8 failed with missing smp_lock.h. Re-running GAs_6.1.26 cleaned out the old version and ran to completion without issue. It works fine now.
Fatal error: linux/smp_lock.h: No such file or directory, nano /lib/modules/../build/linux/smp_lock.h and write // this is dummy! then ctrl + X and press Y and try to compile. Share Improve this answer answered Jun 18, 2014 at 8:11 DummyMan 11 1 Add a comment