Tag Info

Hot answers tagged

26

The POSIX ualarm() function lets you schedule the kernel to periodically signal your process, with microsecond precision. Whip up a simple program: #include<unistd.h> #include<signal.h> void tick(int sig){ write(1, "\n", 1); } int main(){ signal(SIGALRM, tick); ualarm(1000000, 1000000); //alarm in a second, and every second ...


24

Have you tried watch with the parameter --precise? watch -n 1 --precise "date '+%Y-%m-%d %H:%M:%S.%N' >> ~/Desktop/timelog-watch.txt" From the man page: Normally, this interval is interpreted as the amout of time between the completion of one run of command and the beginning of the next run. However, with the -p or --precise option, you can ...


18

crontab has a resolution of 1 minute. If you're fine with lag time accumulating per that minute and then resetting on the next minute, this basic idea could work: * * * * * for second in $(seq 0 59); do /path/to/script.sh & sleep 1s;done Note that script.sh is also run in the background. This should help to minimize the lag that accumulates with ...


14

Your problem is that you're sleeping for a fixed amount of time after you run your program without taking in to consideration the amount of time that has elapsed since the last time you slept. You can do this is bash or any other programming language, but the key is to use the clock to determine how long to schedule the next sleep. Before you sleep, check ...


9

How does this Perl script I just whipped up work? #!/usr/bin/perl use strict; use warnings; use Time::HiRes qw/time sleep/; sub launch { return if fork; exec @_; die "Couldn't exec"; } $SIG{CHLD} = 'IGNORE'; my $interval = shift; my $start = time(); while (1) { launch(@ARGV); $start += $interval; sleep $start - time(); } Use: ...


8

Some embedded systems (a) need to meet difficult real-time requirements, and yet (b) have very limited hardware (which makes it even more difficult to meet those requirements). If you can't change the hardware, then there are several situations where you are forced to rule out Linux and use something else instead: Perhaps the CPU doesn't even have a MMU, ...


7

I've always just given up on having something run exactly on interval. I think you'll have to write a C program, and pay very careful attention to not exceeding the portion of the 1-second interval with your own code. You'll probably have to use threading or multiple, inter-communicating processes to get this to work. Take care to avoid thread-starting or ...


7

You want strace(1) for that; it lists all the system calls made. See the manual page for details on various ways to present the trace data. You might also find ltrace(1) useful if you want inter-library calls rather than system calls traced.


6

A filesystem overlay would probably work better for this. Using something like aufs you can create a 'virtual' directory out of several combined directories. You can configure whether writes should propagate back to the original directories, or use a copy-on-write method to leave the originals alone, or disallow writes altogether. However to answer your ...


6

SCADA describes "Supervisory Control and Data Acquisition" systems - it often is Real Time, but doesn't have to be. There is usually a component that is real time (eg for logging, or managine pressures etc in machinery - ie essential heartbeat stuff) but this isn't absolutely necessary. Many are still legacy code with a TCP/IP front end tacked on, and for ...


5

Well, you could do it with some command line tools. cdrecord (wodim on debian) can burn audio CDs on the fly, but it needs an *.inf files that specify track sizes etc. You can generate an inf file upfront with a dummy CD that has (say) one large audio track (74 minutes) using cdda2wav (icedax on debian). In the live setting you record from an audio device ...


5

Depends - if you actually develope kernel space drivers that use mutexes and semaphores you should give the patches a quick review. As developer that is your responsibility, no answer on a website will solve that issue. If you are mainly developing userspace software, these changes do not affect you, as you only wrangle with the kernel interfaces, which are ...


4

I've not done any real-time work at all so take this with a grain of salt... I'm told there's two categories of "real-time": hard real-time and soft real-time. "Soft real-time" informally means "get it done as fast as possible". I think that Linux on a modern CPU is good for this sort of thing. "Hard real-time" informally means "get it done within a ...


4

If you want to keep two replicas of a directory tree on two different filesystems, then ChironFS might be the solution. It's a FUSE-based filesystem, that replicates any changes to its "virtual" filesystem to two other "real" filesystems. Installation and usage instructions are available here: http://www.furquim.org/chironfs/howto.html


4

System Management Mode is not the only thing that makes x86 bad at hard real time. The unpredictability of the execution speed due to caches, pipelines and so on makes x86, and any other high-end processor, bad at real time. All these features that make a processor fast on average also make the worst case difficult to manage. The current generation of ARM ...


4

Take a look at nanosleep() (from http://linux.about.com/library/cmd/blcmdl2_nanosleep.htm). Instead of making your program sleep 1 second, make it sleep (1 - ammount it takes to run) seconds. You'll get a much better resolution.


4

"Real time" means processes that must be finished by their deadlines, or Bad Things (TM) happen. A real-time kernel is one in which the latencies by the kernel are strictly bounded (subject to possiby misbehaving hardware which just doesn't answer on time), and in which most any activity can be interrupted to let higher-priority tasks run. In the case of ...


4

There is old school console tool: nethogs - Net top tool grouping bandwidth per process e.g. run in this manner: # nethogs eth0 NetHogs version 0.8.0 PID USER PROGRAM DEV SENT RECEIVED 11173 user rtorrent eth0 111.001 4.358 KB/sec 13159 user rtorrent eth0 125.673 3.734 ...


3

Try running your command in the background so it does not affect the loop timing so much, but even that will not be enough if you don't want any accumulation for long periods of time as there is surely a few millisecond cost associated with it. So, this is likely better, but also likely still not good enough: while [ true ]; do date "+%Y-%m-%d %H:%M:%S" ...


3

rmmod 8139too doesn't work because either: 8139 support is built into the kernel, and the driver can't be unloaded because it's not a module. On many systems, there's a /boot/config-2.6.38.8 file (or similar). You can grep it for something like ‘8139TOO’. If you see something like CONFIG_8139TOO=m, then the 8139too driver is compiled as a module. If it's ...


3

No neither eCos nor FreeRTOS are Hurd based. They are different operating systems. eCos and FreeRTOOS are Realtime Operating systems and don't have to do anything with Hurd. Don't try to just arbitrary put different kind of Operating systems together. Plan9 is also considered a successor of Unix and is as far as i know not considered as a Unix system but ...


3

The most immediate downside of running a realtime process is that the process can easily starve out every other process on the system. The result from your point of view will be that the computer is completely unresponsive to keyboard, mouse, and probably network, for as long as the realtime process is using the CPU. This can happen if something goes wrong ...


2

According to the Wikipedia article, SCADA is a description of a type of system (specifically industrial control systems), not any one particular thing.


2

I'm guessing you misunderstand the concept of 'real-timeness'. If not, sorry, but it happens a lot, and I thought I'd throw a little clarification in here. The main point of a real-time kernel is to serve requests within a predictable deadline. That does not necessarily mean faster than a 'normal' kernel. So for desktop systems, a preemptive kernel is good, ...


2

I don't think so. The patch seems to provide real-time scheduling which is very important for some enviroments (planes, nuclear reactors etc.) but overkill for regular desktop. The current kernels however seems to be enough "real-time" and "preemptive" for regular desktop users[1]. It may be useful if you work with high quality audio recording and playing ...


2

SCADA isn't an operating system, it's basically an application that runs on top of an existing operating (The HOST OS). Depending on what the requirements of the SCADA application are, the HOST OS can be a Real Time Operating system, or just a plain vanilla Windows/Linux OS. For example, the systems that do condition monitoring, state estimation, and fault ...


2

You could probably hack this together using inotify and more specifically incron to get notifications of file system events and trigger a backup. Meanwhile, in order to find a more specific solution you might try to better define your problem. If your problem is backup, it might be good to use a tool that is made to create snapshots of file systems, ...


2

Latency is mostly a kernel issue, I'd say that newer kernels (and thus newer distributions) will give better results. Distributions are built on the same base software, so what should make a difference is probably more the familiarity with it (you will have to keep it up to date, and having a half-forgotten system around which is managed in an unfamiliar way ...


2

Planet CCRMA. This is a Fedora-derived distribution optimized for audio. It includes optional realtime/low-latency patches for the kernel (see this part of the docs for details) but notes that recent kernels have a lot of this work integrated already and so you may actually find it good enough for your needs. Within whichever distro you chose, you probably ...


2

Gentoo and some patience. I've run Gentoo on more minimal hardware than that and was able to run a full X11 desktop with minimal WM and Opera Browser on it too. (it was more of an "I wonder if it would work" than a daily use box). I'd recommend Gentoo and the following performance optimizations to limit CPU usage. Compile your kernel options manually ...



Only top voted, non community-wiki answers of a minimum length are eligible