Sponsored Content
Special Forums Hardware Filesystems, Disks and Memory finding out the pid for a busy text file Post 23775 by jxh461 on Friday 28th of June 2002 07:01:40 PM
Old 06-28-2002
Question finding out the pid for a busy text file

Can some one please tell me how to find out the proccess ID that is holding up a file.

I am attempting to remove a file and I am getting a message stating that it is busy.

i.e

rm filename
filename: 777 mode ? (y/n) y
rm: filename not removed. Text file busy

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding out if there is text in a file.

I have a script that when run creates 4 other text files. Sometimes a couple of these text files are empty. So what I am trying to do is find out if there is text in the file and if not delete the file. What I have so far is the following script. I am just not sure how to return a true value... (9 Replies)
Discussion started by: iCONAN
9 Replies

2. UNIX for Dummies Questions & Answers

finding text in a file

How do i find text string in a file if i have no idea where the file is? What I am trying to do is find an email address in a file and have no idea where the file is. Thanks (5 Replies)
Discussion started by: §ynic
5 Replies

3. Shell Programming and Scripting

Finding the nice(ni) number with PID?

Hi, is there a command that takes the PID of a process and that only diplays it's ni number? I`m pretty sure it would require pipes but I tried a few things that ended up miserably... Since the ps command doesn't show the ni unless I do ps -o ni but then I can't find a way to search the right... (2 Replies)
Discussion started by: Yakuzan
2 Replies

4. Shell Programming and Scripting

Finding PID of a process using variable substituition

Hi All, Am copying mulitple files in a directory in names File0,File1,File2 etc. I need to print separately the PID of these copies using File names. for((i=0;i<5;i++)) do mypid=`ps aux | awk '/File$i/ && !/awk/ { print $2 }'` echo PID is $mypid done It printed nothing. Thinking... (6 Replies)
Discussion started by: amio
6 Replies

5. UNIX for Advanced & Expert Users

Filesystem mystery: disks are not busy on one machine, very busy on a similar box

Hi, We have a filesystem mystery on our hands. Given: 2 machines, A and Aa. Machine Aa is the problem machine. Machine A is running Ubuntu, kernel 2.6.22.9 #1 SMP Wed Feb 20 08:46:16 CST 2008 x86_64 GNU/Linux. Machine Aa is running RHEL5.3, kernel 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38... (2 Replies)
Discussion started by: mschwage
2 Replies

6. Solaris

Finding PID of Killing process

Say I have 2 processes(perl scripts on Solaris machine) A and B. the process A kill the process B. While in the process B how do I print the PID of the process that Killed it(process A) before dieing. My process A looks like open(STATS, "ps -ef|"); while ($inputLine = <STATS>) { if... (7 Replies)
Discussion started by: enigma_007
7 Replies

7. Solaris

Finding most busy file system

Hi Experts, I was asked to find most busy file system on one of the server. It is Sun 10. Any idea to get this? Thanks, Deepak (5 Replies)
Discussion started by: naw_deepak
5 Replies

8. Shell Programming and Scripting

Help with finding text in file

Hello, Please help me with this. I have two files. file1.txt and file2.txt File1 contains text as below txt1 txt2 txt3 txt4 txt5 txt6 txt7 txt8 File2 contains text as below $1 $2 $3 $4 $5 $6 $7 $8 $9 ----------------------------- txt1 txt2 - - - 0 2 8 -*- txt0 txt7 - - - 1 4 8... (3 Replies)
Discussion started by: tenderfoot
3 Replies

9. Shell Programming and Scripting

Error in finding the PID by grep and assigning to a variable

Hello All, I am facing difficulty in getting the PID value & then assigning it to a variable, kindly help me in resolving the issue. Thanks a lot in advance. The custom utility used inside the Test2.sh will process the file in a batch of 10 lines at once and for efficient memory management,... (3 Replies)
Discussion started by: duddukuri
3 Replies

10. Shell Programming and Scripting

Help with finding the exit status of a 'nohup' command using 'PID'.

Hello All, I need to run a set of scripts, say 50 of them, parallely. I'm running these 50 scripts, from inside a script with the help of 'nohup' command. 1.The fifty scripts are stored in a separate file. 2.In a master script, i'm reading every line of the file through loop and executing... (4 Replies)
Discussion started by: SriRamKrish
4 Replies
pthread_mutexattr_getspin_np(3T)										  pthread_mutexattr_getspin_np(3T)

NAME
pthread_mutexattr_getspin_np(), pthread_mutexattr_setspin_np(), pthread_mutex_getyieldfreq_np(), pthread_mutex_setyieldfreq_np(), pthread_mutexattr_disable_handoff_np(), pthread_mutex_disable_handoff_np() - get and set mutex spin and yield frequency attributes; disable mutex-specific or process-wide mutex handoff mode SYNOPSIS
PARAMETERS
attr Pointer to the mutex attributes object whose attributes are to be set/retrieved. spin This parameter either specifies the new value of the spin attribute (set function) or points to the memory location where the spin attribute of attr is to be returned (get function). yield This parameter either specifies the new value of the yield frequency process-wide attribute (set function) or points to the mem- ory location where the yield frequency process-wide attribute is to be returned (get function). DESCRIPTION
These attributes are used to tune the mutex locking behavior for optimized application performance on multiprocessor systems. For and the attributes object attr must have previously been initialized with the function before these functions are called. Attribute: spin Mutexes can be initialized with a spin value which is used by for busy-wait iterations on the mutex lock. It is effective only on multi- processor systems. It is ignored on uniprocessor systems. For bound threads, the procedure to block on a busy mutex is quite costly. On a multiprocessor system, the thread holding the mutex may be a few instruction cycles away from releasing it. By performing a brief busy-wait before actually blocking, the lock path can avoid a great deal of overhead in these situations. For many applications, these situations are not rare. Consider a mutex used to protect a short sequence of code (e.g., to increment a counter). The mutex is held only for a few instruction cycles (plus the function call overhead for The ability to set the spin attribute allows the application writer to adjust the busy-wait to suit the duration of the common-case criti- cal section protected by each mutex. The legal values for the spin attribute are: The function will busy-wait on the mutex lock for the specified number of iterations before blocking the thread, unless the lock is acquired sooner. Larger spin values would be appropriate for mutexes associated with longer critical sections. Inhibits blocking on the mutex lock altogether. The function will busy-wait on the mutex lock until it is acquired. Uses a built-in default value for the number of busy-wait iterations. Attribute: yield Note that the yield attribute is not a per-mutex attribute, but is process-wide. That is, it affects the behavior of all mutexes. The yield attribute specifies, for the busy-wait, how frequently the processor should be yielded (via allowing other threads to execute. When the number of threads exceeds the number of processors in a system, a busy-wait on a mutex can sometimes have an adverse effect. The busy-wait itself can prevent the thread holding the lock from completing the associated critical section of code. By yielding the proces- sor on occasion, the thread attempting the lock may allow the thread holding the lock to reach the point at which it can release the lock. However, it still avoids the costly path to block on the mutex. The legal values for the yield attribute are: The busy-wait loop in will yield the processor after each specified number of iterations of the spin loop (where the total number of iterations is con- trolled by the per-mutex spin attribute). Inhibits yielding in the mutex lock altogether. Uses a built-in default value for the frequency of yields in the busy-wait loop. The and functions are provided for binary compatibility purposes only. They will not have any noticeable effect on mutexes. RETURN VALUE
and return the following values: Successful completion. Failure. The returned value is an error number defined in the ERRORS section. (The variable is not set). ERRORS
If an error is detected, and return one of the following error numbers. The value specified by attr, spin, or yield is invalid. was called after the process became multithreaded. WARNINGS
The settings of the spin and yield attributes can, as well as improve application performance, easily lead to degraded performance. The CPU consumption of the application may be increased. Settings which work well for a small number of threads may do poorly for larger num- bers of threads. The optimal settings will vary depending upon hardware and operating system configuration. Minor changes in the applica- tion itself may require retuning of these attributes. The programmer must analyze performance carefully to obtain an understanding of mutex contention within the application. Then, experiment with different attribute values, evaluating how mutex contention is affected, response time, and CPU consumption. AUTHOR
and were developed by HP. SEE ALSO
pthread_create(3T), pthread_mutex_init(3T), pthread_mutexattr_init(3T), rtsched(2) STANDARDS CONFORMANCE
Pthread Library pthread_mutexattr_getspin_np(3T)
All times are GMT -4. The time now is 12:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy