how to list and delete shared memory in linux? List all shared memories in your Linux Systems > $ ipcs -m Delete specific one > $ ipcrm -M 0x0001869c
Tag: memory
What are the differences between NUMA architecture and SMP architecture?
Posted onNUMA Architecture: Non-Uniform Memory Access architecture. SMP: Symmetric Multiprocessing architecture. In a Symmetric Multiprocessor, the architectural “distance” to any memory location is the same for all processors, i.e. “symmetric”. In a NonUniform Memory Access machine, each processor is “closer” to some memory locations than others; i.e. memory is partitioned among them Asymmetrically. From my understanding,
Read more
What is the difference between work conserving I/O scheduler and non-work conserving I/O scheduler?
Posted onWhat is the difference between work conserving I/O scheduler and non-work conserving I/O scheduler? In a work-conserving mode, the scheduler must choose one of the pending requests, if any, to dispatch, even if the pending requests are far away from the current disk head position. The rationale for non-work-conserving schedulers, such as the anticipatory scheduler
Read more
How to estimate the memory usage of HDFS NameNode for a HDFS cluster?
Posted onHDFS stores the metadata of files and blocks in the memory of the NameNode. How to estimate the memory usage of HDFS NameNode for a HDFS cluster? Each file and each block has around 150 bytes of metadata on NameNode. So you may do the calculation based on this. For examples, assume block size is
Read more
Is Samba sync or async for writes?
Posted onBeing sync or async for data writing of a file system or a network file system affects the data integrity. Is Samba sync or async for writes? In summary, Samba writes are async by default. But the behavior is configurable. Here is a great summary by Eric Roseme. Samba defaults to asynchronous writes. smbd writes
Read more
What’s the standard or common data structure for a list of objects in C++?
Posted onIn C++, what’s the standard or common data structure for a list of objects? In C++, the common data structure for a sequence (“list”) of objects may be std::vector. A vector is a dynamically resizable array. It is “The most extensively used container in the C++ Standard Library …, offering a combination of dynamic memory
Read more
What’s the standard or common data structure for a list of objects in C?
Posted onIn C, what’s the standard or common data structure for a list of objects? In C, one common way to store a list/collection of objects of the same type is to use one-dimensional arrays. In C, an array is a collection of data objects of the same type. An array is in a contiguous memory
Read more
How to make sort using multiple threads to run faster?
Posted onsort supports –parallel N to run N thread. However, it seems it only uses around 100% CPU as I observed although the command specified that N threads can be used. The command is as follows cat large-file | sort –parallel `nproc` where I have 16 from nproc. How to make sort use multiple threads to
Read more
What’s the difference between memory coherence and consistency?
Posted onIn memory hierarchical, it needs to be coherence and consistency. However, they are different things. What are the differences? Memory coherence: a memory system is coherent if any read of a data item returns the most recently written value of that data item (what values can be returned by a read). Memory consistency: A memory
Read more
Why I got message “invalid syntax, continuing…” when I execute “sysctl”?
Posted onWhen I tried to apply new configuration in /etc/sysctl.conf, I got following message. warning: /etc/sysctl.conf(44): invalid syntax, continuing… Sounds like your changed /etc/sysctl.conf has problem. You may post the content of your /etc/sysctl.conf here to let other have a check. net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1
Read more
Where is the source code for the free command on Linux?
Posted onWhere can I find the source code for the free command on Linux? The source code for the free commands (and many more, like kill, ps, top, sysctl) can be found in procps-ng: https://gitlab.com/procps-ng/procps procps is a set of command line and full-screen utilities that provide information out of the pseudo-filesystem most commonly located at
Read more
Implementation of strstr in glibc
Posted onWhat is the implementation of strstr in glibc? Implementation of STRSTR in glibc (string/strstr.c): /* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK if NEEDLE is empty, otherwise NULL if NEEDLE is not found in HAYSTACK. */ char * STRSTR (const char *haystack_start, const char *needle_start) { const char *haystack = haystack_start; const
Read more
How to increase the number of files allowed to be opened on Linux?
Posted onOn my system: $ ulimit -n 1024 Some tools like GATK are aggressive in creating temporary files by creating more than 1000 files under /tmp/. This will cause the program to fail. How to increase the number of files allowed to be opened on Linux? To increase the max number of open files to 10240,
Read more
Making Hadoop Java process heap larger?
Posted onIn Hadoop 2.5.0, I use ‘ps -aux’ and find the Java process has options: -Xmx1000m However, my nodes have 32GB memory. How to make Hadoop Java process heap larger? In yarn-env.sh, you can find: # For setting YARN specific HEAP sizes please use this # Parameter and set appropriately # YARN_HEAPSIZE=1000 In hadoop-env.sh, you can
Read more
x86-64 instructions for floating-point comparisons
Posted onWhat are the x86-64 instructions for floating-point comparisons like the cmpq for quard-word integer comparison? The SSE3 extenstions provide two instructions for comparing floating values: Instruction Based on Description ucomiss S2, S1 S1 – S2 Compare single precision ucomisd S2, S1 S1 – S2 Compare double precision As with cmpq, they follow the GAS convention
Read more
How to detect memory leaks of C programs in Linux?
Posted onHow to detect memory leaks of C programs in Linux? I also have access to the source code of the program. There are many posts related to this: Easy and quick tools on Linux (while not very accurate): http://blog.thewebsitepeople.org/2011/03/linux-memory-leak-detection/ Valgrind: manual and a tutorial. gperftools has the Google Heap Profiler which can checks for memory
Read more
Xen HVM DomU configuration file
Posted onAn example of Xen HVM DomU configuration file. An example for install the OS from an ISO: name=”10.0.1.235″ vcpus=2 memory=2048 shadow_memory=8 disk=[‘file:/lhome/xen/vm-10.0.1.235/vmdisk0,xvda,w’, ‘file:/lhome/Linux-x86_64-DVD.iso,xvdc:cdrom,r’] vif=[‘bridge=xenbr0′] kernel=’/usr/lib/xen/boot/hvmloader’ builder=’hvm’ device_model=’/usr/lib64/xen/bin/qemu-dm’ extra=” vnc=1 vnclisten=”0.0.0.0″ vncpasswd=’1234567′ # vncdisplay=1 vncconsole=1 on_reboot=’restart’ on_crash=’restart’ An example for run the VM after installation: name=”10.0.1.235″ vcpus=2 memory=2048 shadow_memory=8 disk=[‘file:/lhome/xen/vm-10.0.1.235/vmdisk0,xvda,w’] vif=[‘bridge=xenbr0′] kernel=’/usr/lib/xen/boot/hvmloader’ builder=’hvm’ device_model=’/usr/lib64/xen/bin/qemu-dm’ extra=” vnc=1
Read more
Max array length in OCaml
Posted onWhat’s the max array length in OCaml. You can check it by: # Sys.max_array_length;; On 64-bit machine: # Sys.max_array_length;; – : int = 18014398509481983 On a 32-bit machne: # Sys.max_array_length;; – : int = 4194303 This is due to the memory representation of arrays. 64 Bit machines are better here. And AFAIK, OCaml was developed
Read more
How to change the maximum execution time and memory size allowed for PHP
Posted onI see this message in the error log of httpd: PHP Fatal error: Maximum execution time of 30 seconds exceeded in and PHP Fatal error: Allowed memory size of 268435456 bytes exhausted How to change them to a longer and larger value? To change the allowed maximum memory usage of PHP: Set memory_limit = 256M
Read more
Where are the Linux routing table entries stored on disk?
Posted onI know the routing tables on Linux is in memory after being set. However, where are the routing table entries stored on disk? I mean where are the routing table is persistently stored so that the routing table can be reloaded like the iptables (under /etc/sysconfig/iptables on Fedora/RHEL/CentOS Linuxes). If the system uses the /etc/rc.d/init.d/network
Read more