02-24-2020
Question about WCHAN values
I have a CentOS 8 (3.10) running on VirtualBox 6.0... And I have 2 questions about WCHAN
The 'ps' man page describes WCHAN as:
Quote:
nwchan WCHAN address of the kernel function where the process
is sleeping (use wchan if you want the kernel
function name). Running tasks will display a
dash ('-') in this column.
wchan WCHAN name of the kernel function in which the process
is sleeping, a "-" if the process is running, or
a "*" if the process is multi-threaded and ps is
not displaying threads.
I haven't see the "*" yet, but I'll see a "?" in the output of the "ps" command with regularity. Usually associated with the rcu_sched kernel process, but the "?" does appear for other processes. I haven't found a definition for the "?"... What does it mean?
My 2nd question is about a discrepancy I'm seeing between the output of the 'ps' command and the 'System Monitor' GUI utility. Under the 'ps' command, I'll see several processes in a run state and will have a "-" under WCHAN. Yet under the "System Monitor", those same processes will be in a run state with a WCHAN code of "poll_schedule_timeout". From what I've read this indicates a process is waiting for I/O... Shouldn't these processes be in a sleep state?
Last edited by bodisha; 02-24-2020 at 01:45 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
Do you have any idea why the below sed command is also replacing the value of "PARAMETER2" instead of just "PARAMETER" in file1 ?
% parameter=PARAMETER
% new_value=2
% cat file1
PARAMETER=1
PARAMETER2=1
% cat file1 | sed s/*$/${new_value}/1
PARAMETER=2
PARAMETER2=2
Thanks. (3 Replies)
Discussion started by: majormark
3 Replies
2. Shell Programming and Scripting
Dear Guyz:)
I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z).
I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies
3. UNIX for Advanced & Expert Users
Thanks in advance.
My environment is Ubuntu 9.04 desktop customized to be a high school classroom server for teaching code development. I have a unique "fake" jail called "lshell" which is very easy to setup and restricts users to commands that I dictate DISALLOWING ANYTHING ELSE. These... (6 Replies)
Discussion started by: tuxhats
6 Replies
4. UNIX for Dummies Questions & Answers
Hi. Before throwing my question, thanks to everybody for paying attention. Sorry if my english isn't good enough, but it's not my mother tongue.
That's my question:
I have a java program that throws an external program with "Process p = Runtime.getRuntime.exec(***)". The communication between... (2 Replies)
Discussion started by: jlopezperez
2 Replies
5. Shell Programming and Scripting
- I have two files (File 1 and File 2) and the contents of the files are mentioned below.
- I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2.
- I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies
6. Shell Programming and Scripting
Hello All,
I have a below data in a .csv file where all rows where col1 is A, col2 is odd numbers, similarly even numbers for all rows where col1 is B.
Note that my data has some other columns(not shown here) too (around 100) after col2.
Tool,Data
A,1
A,3
A,5
....
so on
B,2
B,4
.... ... (4 Replies)
Discussion started by: ks_reddy
4 Replies
7. Shell Programming and Scripting
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies
8. Shell Programming and Scripting
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies
9. Shell Programming and Scripting
Hi,
I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below...
if (start_new_rec=="true"){
exclude_user="false";
user=toupper($6);
match(user, "XXXXX.");
if (RSTART ==2 ) {
... (9 Replies)
Discussion started by: asandy1234
9 Replies
10. UNIX for Dummies Questions & Answers
Hi,
Sorry for a dummy question I believe. I am just wanting to know how do I assign a default $1 argument if one is not provided.
At the moment, I am doing something like below:
arg1="${1:-foo}"And then I check $arg1 in case/esac. I am just wondering if there is a way for me to simply do... (3 Replies)
Discussion started by: newbie_01
3 Replies
LEARN ABOUT NETBSD
tsleep
LTSLEEP(9) BSD Kernel Developer's Manual LTSLEEP(9)
NAME
ltsleep, tsleep, wakeup -- process context sleep and wakeup
SYNOPSIS
#include <sys/proc.h>
int
tsleep(wchan_t ident, pri_t priority, const char *wmesg, int timo);
void
wakeup(wchan_t ident);
DESCRIPTION
The interfaces described in this manual page are obsolete and will be removed from a future version of the system.
The ltsleep() interface has been obsoleted and removed from the system.
Please see the condvar(9), mutex(9), and rwlock(9) manual pages for information on kernel synchronisation primitives.
These functions implement voluntary context switching. tsleep() is used throughout the kernel whenever processing in the current context can
not continue for any of the following reasons:
o The current process needs to await the results of a pending I/O operation.
o The current process needs resources (e.g., memory) which are temporarily unavailable.
o The current process wants access to data-structures which are locked by other processes.
The function wakeup() is used to notify sleeping processes of possible changes to the condition that caused them to go to sleep. Typically,
an awakened process will -- after it has acquired a context again -- retry the action that blocked its operation to see if the ``blocking''
condition has cleared.
The tsleep() function takes the following arguments:
ident An identifier of the ``wait channel'' representing the resource for which the current process needs to wait. This typically is the
virtual address of some kernel data-structure related to the resource for which the process is contending. The same identifier
must be used in a call to wakeup() to get the process going again. ident should not be NULL.
priority The process priority to be used when the process is awakened and put on the queue of runnable processes. This mechanism is used to
optimize ``throughput'' of processes executing in kernel mode. If the flag PCATCH is OR'ed into priority the process checks for
posted signals before and after sleeping.
wmesg A pointer to a character string indicating the reason a process is sleeping. The kernel does not use the string, but makes it
available (through the process structure field p_wmesg) for user level utilities such as ps(1).
timo If non-zero, the process will sleep for at most timo/hz seconds. If this amount of time elapses and no wakeup(ident) has occurred,
and no signal (if PCATCH was set) was posted, tsleep() will return EWOULDBLOCK.
The wakeup() function will mark all processes which are currently sleeping on the identifier ident as runnable. Eventually, each of the pro-
cesses will resume execution in the kernel context, causing a return from tsleep(). Note that processes returning from sleep should always
re-evaluate the conditions that blocked them, since a call to wakeup() merely signals a possible change to the blocking conditions. For
example, when two or more processes are waiting for an exclusive-access lock (see lock(9)), only one of them will succeed in acquiring the
lock when it is released. All others will have to go back to sleep and wait for the next opportunity.
RETURN VALUES
tsleep() returns 0 if it returns as a result of a wakeup(). If a tsleep() returns as a result of a signal, the return value is ERESTART if
the signal has the SA_RESTART property (see sigaction(2)), and EINTR otherwise. If tsleep() returns because of a timeout it returns
EWOULDBLOCK.
SEE ALSO
sigaction(2), condvar(9), hz(9), lock(9), mutex(9), rwlock(9)
HISTORY
The sleep/wakeup process synchronization mechanism is very old. It appeared in a very early version of Unix. tsleep() appeared in 4.4BSD.
ltsleep() appeared in NetBSD 1.5.
BSD
January 28, 2012 BSD