Sponsored Content
Top Forums Programming parsing currently running processes Post 302092736 by blowtorch on Thursday 12th of October 2006 03:09:41 AM
Old 10-12-2006
Hi Hitori,
I don't want to know how to read the process details. I am doing that already. My program will have a list of, lets say, command lines patterns, that it has to match against currently running processes. It will do this in an infinite loop, raising alerts if any of the process patterns are not found in the list of running processes or if the number of matches are too few or too many.

It may have to go through the list of running processes every minute (maybe, depending on the configuration). So, my question is whether it would be better to create a list of command line entries from the /proc every minute and go through my list and match (the entire list of current processes would be processes for every entry in my list), or should I go through the all /proc entries for each of the entries in my list.

The first method involves creating a list of an unknown size but issuing the /proc reading commands (readdir, open, read, stat) just once. The second method requires the readdir, open, read commands to be executed for the entire /proc filesystem for each process pattern in my list.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running two processes in background

hi there, here's what i need in my korn-shell: ... begin korn-shell script ... nohup process_A.ksh ; nohup process_B.ksh & ... "other stuff" ... end lorn-shell script in plain english i want process A and process B to run in the background so that the script can continue doing... (6 Replies)
Discussion started by: jacob_gs
6 Replies

2. Programming

getting certain info for all processes currently running

i am writing a utility that displays information about all the running processes in the /proc directory. I do not know how to get the following information for each of the processes in the /proc directory: -effective user id -effective user name -effective group id -effective group name... (3 Replies)
Discussion started by: Yifan_Guo
3 Replies

3. Solaris

About running processes in background

Hi, I need to establish a procedure that will start an application in background each time my remote Solaris server is (re)started. This would be a kind of daemon. I am no sysadmin expert, so I am looking for pointers. How should I proceed? What are the main steps? Thanks, JVerstry (9 Replies)
Discussion started by: JVerstry
9 Replies

4. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (2 Replies)
Discussion started by: Ikebana
2 Replies

5. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (5 Replies)
Discussion started by: Ikebana
5 Replies

6. Shell Programming and Scripting

how to know the running processes.

Hi can anybody help me regarding this.. i want know the output of ps -ef with explanation. how can we know the running processess. this is the output of ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 19 T root 0 0 0 0 SY ... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

7. Solaris

Running processes on GZ/LZ

Hi guys just a question is it normal to see running process on a non-global zone in the global zone... processes such as cron. (3 Replies)
Discussion started by: batas
3 Replies

8. Linux

Running processes

Hi guys is it normal to have 5-10 cron/syslog processes running... in my case i got 10 cron process running. (4 Replies)
Discussion started by: batas
4 Replies

9. Solaris

Sendmail processes not running

Hi All! I am trying to get sendmail to work but unsuccessfull...when I run ps -ef | grep sendmail root 10578 10561 0 11:01:24 pts/1 0:00 grep sendmail I do not see its processes When I run the following commands: bash-3.00# svcs sendmail svcs: Pattern 'sendmail' doesn't match... (9 Replies)
Discussion started by: fretagi
9 Replies

10. UNIX for Beginners Questions & Answers

Many processes running at the same time

Hello everybody , I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!! My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Discussion started by: beautymind
14 Replies
serialize(2)							System Calls Manual						      serialize(2)

NAME
serialize() - force target process to run serially with other processes SYNOPSIS
DESCRIPTION
The system call is used to force the target process referenced by the pid value passed in to run serially with other processes also marked for serialization. If the value of pid is zero, then the currently running process is marked for serialization. Once a process has been marked by the process stays marked until process completion, unless is reissued on the serialized process with timeshare set to 1. If timeshare is set to 1, the process specified in pid will be returned to normal timeshare scheduling algorithms. This call is used to improve process throughput since process throughput usually increases for large processes when they are executed seri- ally instead of allowing each program to run for only a short period of time. By running large processes one at a time, the system makes more efficient use of the CPU as well as system memory, since each process does not end up constantly faulting in its working set, to only have the pages stolen when another process starts running. As long as there is enough memory in the system, processes marked by behave no differently from other processes in the system. However, once memory becomes tight, processes marked by are run one at a time with the highest priority processes being run first. Each process runs for a finite interval of time before another serialized process is allowed to run. RETURN VALUE
returns zero upon successful completion, or nonzero if the system call failed. ERRORS
If fails, it sets (see errno(2)) to the following value: The pid passed in does not exist. WARNINGS
The user has no way of forcing an execution order on serialized processes. AUTHOR
was developed by HP. SEE ALSO
serialize(1), privileges(5). serialize(2)
All times are GMT -4. The time now is 04:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy