Skip to content
Advertisement

Tag: unix

What does “high involuntary context” switches mean?

I have re-written a part of code in C. When testing it with logging the resource usage using getrusage(2) C API. Before changing the code: After changing: I see a lot of involuntary context switches being done in the code I have re-written. My question is not about how to reduce context switches. But.. What happens when “involuntary context switches”

Program output changes when piped

I have a simple C program to time process startup (I’d rather not post the full code as it’s an active school assignment). My main function looks like this: sample_time() is a function that times how long it takes to fork a new process and returns the result in seconds as a double. The part of sample_time() that forks: As

Redirecting pv output to file

I’m using the pv utility to asses the speed of log entries being added in a log file, like this: This outputs the addition speed and refreshes every 5 sec: Now, I would like to redirect the current value (“10”) to a file and refresh it every 5s. Not append it, just overwrite the previous value in the file. Any

Find the sum of an infinite series

How can I find the sum of an infinite series? Series: My misbehaving example: Is it possible to carry out this method correct calculation or how to resolve this problem in other ways? Answer This series does not converge. It’s called the harmonic series and it’s known to do not converge. Moreover, as a comment says, you need to start

Equivalent lsof -i in Solaris

I have a fast question. I want to know what is the losf -i equivalent command in a Solaris system. I only want to show the files with network connection. Thank you!! Answer Here is a shell script that list all processes having open TCP or UDP ports on Solaris, you can limit it to a given port number by

How to grep a group of files within a specific time range

I’m trying to write a script used on a buffer box that does full packet capture of network traffic. As it’s for a fairly big network we split the captures into 100MB segments. At times of high network traffic oftentimes over a one minute period we will have multiple pcaps which cover that period. So what I want to do

comparing two files with different columns

i have the two files(count.txt, count1.txt). i need to do the following 1. get the values from count.txt and count1.txt where 1st column is equal. 2. if its equal need to compare the 2nd column like ((1st column value + 5) >= 2 column value) count.txt order1,150 order2,165 order3,125 count1.txt order1,155 order2,170 order3,125 order4,123 and i want the output like

Advertisement