Skip to content
Advertisement

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

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

Advertisement