In this answer author states: With the 64-bit x86_64 kernel, a 32-bit process can use the entire 4GB address space, except for a couple pages (8KB) at the end of the 4GB address space which are managed by the kernel. What is the purpose of this kernel-managed memory? Shouldn’t it be in the kernel space, to prevent accidental corruption by
x86_64 Assembly Linux System Call Confusion
I am currently learning Assembly language on Linux. I have been using the book ‘Programming From the Ground Up’ and all the examples are 32-bit. My OS is 64-bit and I have been trying to do all the examples in 64-bit. I am having trouble however: This merely just calls the Linux exit System call or it should. Instead it
How Linux handles threads and process scheduling
I’m trying to understand how Linux handles process scheduling and thread scheduling. I read that Linux can schedule both processes and threads. Does Linux have a thread scheduler AND a process scheduler? If yes, how do they cooperate? Answer The Linux kernel scheduler is actually scheduling tasks, and these are either threads or (single-threaded) processes. So a task (a task_struct
How can I obtain a case sensitive path on Linux without directory iteration?
Given a mounted cifs file system /network/cifs which is case insensitive, how do I obtain the case sensitive path using C? For example, the fs has a file /network/cfis/Adena/t.txt. Given /network/cfis/AdEnA/T.txt (which properly resolves), I want /network/cfis/Adena/t.txt. I know one way to do it is to recursively iterate over the path, match them in all lower case, and get the
Is malloc/free a syscall or a library routine provided by libc?
If malloc/free is implemented as a library routine in libc, then is it implemented on top of the sbrk syscall or the mmap syscall, or something else? And to be general, does the function declared in sys/syscall.h contains ALL the system calls in the target machine? Answer malloc and free are standard C library functions which are to be implemented
Can Python select what network adapter when opening a socket?
The target machine running the python application will have three network interfaces available to it. In general all three networks will be vastly different, however there is a possibility that two of the three could be on similar networks. In the example below I do not have control over the destination address on ETH 2 (as it a pre-configured system),
High performance reading – linux/pthreads
I have moderately large binary file consisting of independent blocks like this: header1 data1 header2 data2 header3 data3 … The number of blocks, the size of each block and the total size of the file vary quite a lot, but typical numbers are ~1000 blocks and average blocksize 100kb. The files are generated by an external application which I have
How to make GREP select only numeric values?
I use the df command in a bash script: This script returns: But I need only numbers (to make the next comparison). If I use the grep regex without the dot: I receive nothing. How to fix? Answer If you try: It returns: Here’s the details on the -o (or –only-matching flag) works from the grep manual page. Print only
.txt file is no longer written to by snmptrapd daemon after opening and closing with ifstream in C++
I am running Net-Snmp (environment is a virtual machine running Linux Mint OS 11) and have configured it to send trap information to a text file that I have called trapd.txt. If I reboot the VM, any trap that is generated is sent to the file no problem. However If I run a C++ program using ifstream to open it
Increasing the caching capability of MySQL
My mysql only caters read requests. I thought, it will be a good idea to make use of the cache completely. I am running MySQL in a VM and that is the only application running inside the VM. I am allocating 2GB memory for that VM. I am using a 64 bit centos on the VM. If you think already