the difference between I/O schedule in dmesg and queue/schedule - linux-kernel

I executed two commands in system, in first command, I saw five kinds I/O schedule which os system support; but in second command, there are only three choices I can switch. I'm a little confused, could you please tell me how to switch schedule to 'deadline' in /sys/block/vdb/queue/scheduler?
>dmesg|grep -i schedule
[ 1.099428] io scheduler noop registered
[ 1.100254] io scheduler deadline registered (default)
[ 1.101232] io scheduler cfq registered
[ 1.102042] io scheduler mq-deadline registered
[ 1.102918] io scheduler kyber registered
[862565.814586] nr_pdflush_threads exported in /proc is scheduled for removal
>cat /sys/block/vdb/queue/scheduler
[mq-deadline] kyber none

Related

trace-cmd should record 2 functions and all task switches

I want to record certain network driver activity with trace-cmd, but at the same time also all task switches and interrupts by IRQs. I want to find out which process disturbs my driver.
I know:
trace-cmd record -o /tmp/trace.dat -p function -l foo_function -l foo_function2 -e 'foo:foo_ev'
But which are the additional options for also recording all task switches and switches to and from IRQs?

injecting AT command to gammu SMS daemon

I need to do call diverts(redirects) on SIM card which is used by gammu sms daemon all the time.
The divert operation can be done few times per day.
Gammu sms daemon is occupying communication with GSM modem 24h/day.
I cannot send any AT command to port, while daemon is running.
Gammu tool(not daemon) have ready to use commands to divert calls, and they work perfectly, while daemon is stopped.
Of course, when daemon is running command correctly claims, that port is busy.
Is there any way to gently inject AT commands to gammu-smsd, and read the response?
My idea is to:
1. Stop daemon.
2. Perform call divert, read the result
3. Start daemon
but this idea don't look like smart or elegant solution.
If injecting commands to sms daemon is not possible, is there any gentle way to stop the daemon not by killing process? I don't want to interrupt daemon work, while it is sending SMS.
You can use SIGUSR1 and SIGUSR2 to suspend and resume the daemon and use Gammu command line while SMSD is suspended.
See Gammu SMSD Signals Documentation for more information. There is even example for this:
SMSD_PID=`pidof gammu-smsd`
if [ -z "$SMSD_PID" ] ; then
echo "Failed to figure out SMSD PID!"
else
kill -SIGUSR1 $SMSD_PID
gammu identify
kill -SIGUSR2 $SMSD_PID
fi

why init process is an user_space thread?

init process is created by 0 process and its pid is 1. I have known it's the ancestor of all the other processes except 0 process. init process creates idle process for each cpu in smp system and execute /sbin/init.But why it's a user_space process? It's behavior is more like a kernel-thread.
There is no process with pid 0.
/sbin/init is userspace program and it is the first process launched by kernel if kernel command line does not have init= as an argument.
It is idle task not a process and it is not user-space process. init process does not create idle-task.

Kafka in supervisor mode

I'm trying to run kafka in supervision mode so that it can start automatically in case of a shutdown. But all the examples of running kafka use shell scripts and the supervisord is not able to note which PID to monitor. Can anyone suggesthow to accomplish auto restart of kafka?
If you are on a Unix or Linux machine, then this is when /etc/inittab comes in handy. Or you might want to use daemontools. I don't know about Windows though.
We are running Kafka under Supervisord (http://supervisord.org/), it works like a charm. Run command looks like this (as specified in supervisord.conf file:
command=/usr/local/bin/pidproxy /var/run/kafka.pid /usr/lib/kafka/bin/kafka-server.sh -f -p /var/run/kafka.pid
Flag -f tells Kafka to start in foreground. If flag -p is set, Kafka process PID is written into specified file.
The command pidproxy is a part of Supervisord distribution. Upon receiving KILL signal, it reads PID from specified file, and forwards the signal to the corresponding process.

How to wait in script until device is connected

I have a Sky wireless sensor node and a script which prints the output from the node.
sudo ./serialdump-linux -b115200 /dev/tmotesky1
If I start this script before my pc detects the node, I get the following error:
/dev/tmotesky1: No such file or directory
But if I wait for example 20 seconds, I miss the initial prints (which are important).
Is there a way to detect if the /dev/tmotesky1 exists?
Something like
while [ ! -f /dev/tmotesky1 ] ; do sleep 1; print 'Waiting...'; done
Thanks in advance!
Your code indicates that you are using Linux where you can use the hotplugging mechanism.
On generic systems, you can write an udev rule (--> see with udevadmin monitor -e what happens when you attach the device) which starts e.g. a program or writes something into a pipe. When systemd is used, you can start a service (see man systemd.device).
On small/embedded systems it is possible to write a custom /sbin/hotplug program (set in /proc/sys/kernel/hotplug) instead of using udev.

Resources